This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Fix python compatibility with old versions of GDB
> On Jun 13, 2017, at 7:23 AM, Simon Marchi <simon.marchi@polymtl.ca> wrote:
>
> On 2017-06-12 06:31, Orgad Shaneh wrote:
>> On Mon, Jun 12, 2017 at 12:09 AM, Simon Marchi <simon.marchi@polymtl.ca> wrote:
>>> Hi Orgad,
>>> I still don't understand what problem this is trying to fix. It looks like
>>> you want to make older versions of GDB work with newer versions of the
>>> Python scripts in the data directory. I am not sure this is what we want.
>>> If you want multiple version of GDB in parallel on a system, they should all
>>> be compiled with a different --prefix, and they will all get their own
>>> data-directory. We should only expect a certain version of the data
>>> directory to be compatible with the version of GDB it was shipped with. Or
>>> am I missing some use case where this is not true?
>> Hi,
>> Practically the data-directory is mostly backwards-compatible, except this
>> small part which I found (there might be others which I didn't find). With this
>> patch, I'm able to run GDB 7.8 with the latest data-directory.
>> Is there a reason not to accept it?
>
> I'd like to know what other maintainers think about this. We may have already faced this situation before and taken a decision which I'm not aware of. Otherwise, we need to take it now.
Are we talking about GDB-supplied scripts, or user scripts?
For scripts that come with GDB, the script comes with the rest of GDB so it can be specific to a version. That makes for more work in creating or modifying GDB, but it's our problem.
User scripts should deliver backward compatibility: a script that conforms to the documented API should continue to work in later releases. The converse doesn't hold, of course: a script written to the latest API doesn't necessarily work with older versions, just as a program written to C11 doesn't necessarily compile or run with C89.
As for Python 2 vs. 3, GDB supports both and the Python-facing API is the same (modulo the places where Python 3 itself is different, such as around strings vs. bytes or ints vs. long ints). A simple script may work with both; a more complex script might not be unless the author goes through some effort to make it so. But that's not particularly related to GDB, it's more a question of how you write Python-version-independent scripts.
paul