Python Scripting Question

Tom Tromey tromey@redhat.com
Mon Nov 9 17:23:00 GMT 2009


>>>>> "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



More information about the Gdb mailing list