]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gdb/doc: add some notes on selecting suitable attribute names
authorAndrew Burgess <aburgess@redhat.com>
Wed, 10 Jan 2024 15:42:55 +0000 (15:42 +0000)
committerAndrew Burgess <aburgess@redhat.com>
Fri, 12 Jan 2024 11:21:32 +0000 (11:21 +0000)
commit53d0889088d00661c97dfd9496f0aea7c4499f32
tree38d0929d57eca7a67427113c3df53dc586b07ec2
parent1d586eda5c90bb9e03e997682dce60811f978def
gdb/doc: add some notes on selecting suitable attribute names

In previous commits I've added Object.__dict__ support to gdb.Inferior
and gdb.InferiorThread, this is similar to the existing support for
gdb.Objfile and gdb.Progspace.

This commit extends the documentation to offer the user some guidance
on selecting good names for their custom attributes so they
can (hopefully) avoid conflicting with any future attributes that GDB
might add.

The rules I've proposed are:

  1. Don't start user attributes with a lower case letter, all the
  current GDB attributes start with a lower case letter, and I suspect
  all future attributes would also start with a lower case letter, and

  2. Don't start user attributes with a double underscore, this risks
  conflicting with Python built in attributes (e.g. __dict__) - though
  clearly the user would need to start and end with a double
  underscore, but it seemed easier just to say no double underscores.

I'm doing this as a separate commit as I've updated the docs for the
existing gdb.Objfile and gdb.Progspace so they all reference a single
paragraph on selecting attribute names.

Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Approved-By: Tom Tromey <tom@tromey.com>
gdb/doc/python.texi