This is the mail archive of the gdb@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: Python Scripting Question


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


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