This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Python Scripting Question
- From: Tom Tromey <tromey at redhat dot com>
- To: Arjun Roy <roy dot arjun at gmail dot com>
- Cc: gdb at sourceware dot org
- Date: Mon, 09 Nov 2009 09:41:54 -0700
- Subject: Re: Python Scripting Question
- References: <4AF63479.7010602@gmail.com> <m31vk7ll74.fsf@fleche.redhat.com>
- Reply-to: tromey at redhat dot com
>>>>> "Tom" == Tom Tromey <tromey@redhat.com> writes:
Arjun> Traceback (most recent call last):
Arjun> File "<string>", line 2, in <module>
Arjun> TypeError: argument 1 must be string without null bytes, not str
Arjun> Error while executing Python code.
Arjun> Is this a bug, am I misunderstanding the right way to do it, or what?
Tom> It is a bug.
I looked into this a little.
The fix is to make python.c:execute_gdb_command copy the command string
before passing it to execute_command. This avoids gdb commands trashing
Python-owned strings.
It isn't clear to me that gdb commands are allowed to overwrite their
argument strings, though. Are they? disassemble_command does do this,
but it seems wrong to me -- won't it permanently modify the command
stored in a command script?
I'll check in the python fix after testing.
Tom