public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@ericsson.com>
To: <gdb-patches@sourceware.org>
Cc: Simon Marchi <simon.marchi@ericsson.com>
Subject: [pushed] Format gdb-gdb.py.in with autopep8
Date: Wed, 27 Jun 2018 19:31:00 -0000	[thread overview]
Message-ID: <1530127899-7088-1-git-send-email-simon.marchi@ericsson.com> (raw)

Format using "autopep8 -i".

gdb/ChangeLog:

	* gdb-gdb.py.in: Format using autopep8.
---
 gdb/ChangeLog     |  4 ++++
 gdb/gdb-gdb.py.in | 24 +++++++++++++++++++++---
 2 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d8bae23..be45bc3 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
 2018-06-27  Simon Marchi  <simon.marchi@ericsson.com>
 
+	* gdb-gdb.py.in: Format using autopep8.
+
+2018-06-27  Simon Marchi  <simon.marchi@ericsson.com>
+
 	* gdb-gdb.py.in (CoreAddrPrettyPrinter): New class.
 	(type_lookup_function): Recognize CORE_ADDR values.
 
diff --git a/gdb/gdb-gdb.py.in b/gdb/gdb-gdb.py.in
index 436f05c..363a93e 100644
--- a/gdb/gdb-gdb.py.in
+++ b/gdb/gdb-gdb.py.in
@@ -18,6 +18,7 @@
 import gdb
 import os.path
 
+
 class TypeFlag:
     """A class that allows us to store a flag name, its short name,
     and its value.
@@ -34,6 +35,7 @@ class TypeFlag:
       value: The associated value.
       short_name: The enumeration name, with the suffix stripped.
     """
+
     def __init__(self, name, value):
         self.name = name
         self.value = value
@@ -42,12 +44,13 @@ class TypeFlag:
     def __lt__(self, other):
         """Sort by value order."""
         return self.value < other.value
-        
+
 
 # A list of all existing TYPE_INSTANCE_FLAGS_* enumerations,
 # stored as TypeFlags objects.  Lazy-initialized.
 TYPE_FLAGS = None
 
+
 class TypeFlagsPrinter:
     """A class that prints a decoded form of an instance_flags value.
 
@@ -59,8 +62,10 @@ class TypeFlagsPrinter:
     If not, then printing of the instance_flag is going to be degraded,
     but it's not a fatal error.
     """
+
     def __init__(self, val):
         self.val = val
+
     def __str__(self):
         global TYPE_FLAGS
         if TYPE_FLAGS is None:
@@ -73,6 +78,7 @@ class TypeFlagsPrinter:
         else:
             flag_list = ["???"]
         return "0x%x [%s]" % (self.val, "|".join(flag_list))
+
     def init_TYPE_FLAGS(self):
         """Initialize the TYPE_FLAGS global as a list of TypeFlag objects.
         This operation requires the search of a couple of enumeration types.
@@ -94,10 +100,13 @@ class TypeFlagsPrinter:
                       for field in iflags.fields()]
         TYPE_FLAGS.sort()
 
+
 class StructTypePrettyPrinter:
     """Pretty-print an object of type struct type"""
+
     def __init__(self, val):
         self.val = val
+
     def to_string(self):
         fields = []
         fields.append("pointer_type = %s" % self.val['pointer_type'])
@@ -109,10 +118,13 @@ class StructTypePrettyPrinter:
         fields.append("main_type = %s" % self.val['main_type'])
         return "\n{" + ",\n ".join(fields) + "}"
 
+
 class StructMainTypePrettyPrinter:
     """Pretty-print an objet of type main_type"""
+
     def __init__(self, val):
         self.val = val
+
     def flags_to_string(self):
         """struct main_type contains a series of components that
         are one-bit ints whose name start with "flag_".  For instance:
@@ -124,9 +136,9 @@ class StructMainTypePrettyPrinter:
         """
         fields = [field.name.replace("flag_", "")
                   for field in self.val.type.fields()
-                  if field.name.startswith("flag_")
-                     and self.val[field.name]]
+                  if field.name.startswith("flag_") and self.val[field.name]]
         return "|".join(fields)
+
     def owner_to_string(self):
         """Return an image of component "owner".
         """
@@ -134,6 +146,7 @@ class StructMainTypePrettyPrinter:
             return "%s (objfile)" % self.val['owner']['objfile']
         else:
             return "%s (gdbarch)" % self.val['owner']['gdbarch']
+
     def struct_field_location_img(self, field_val):
         """Return an image of the loc component inside the given field
         gdb.Value.
@@ -152,6 +165,7 @@ class StructMainTypePrettyPrinter:
             return 'dwarf_block = %s' % loc_val['dwarf_block']
         else:
             return 'loc = ??? (unsupported loc_kind value)'
+
     def struct_field_img(self, fieldno):
         """Return an image of the main_type field number FIELDNO.
         """
@@ -166,6 +180,7 @@ class StructMainTypePrettyPrinter:
         fields.append("bitsize = %d" % f['bitsize'])
         fields.append(self.struct_field_location_img(f))
         return label + "\n" + "  {" + ",\n   ".join(fields) + "}"
+
     def bounds_img(self):
         """Return an image of the main_type bounds.
         """
@@ -177,6 +192,7 @@ class StructMainTypePrettyPrinter:
         if b['high_undefined'] != 0:
             high += " (undefined)"
         return "flds_bnds.bounds = {%s, %s}" % (low, high)
+
     def type_specific_img(self):
         """Return a string image of the main_type type_specific union.
         Only the relevant component of that union is printed (based on
@@ -245,11 +261,13 @@ def type_lookup_function(val):
         return CoreAddrPrettyPrinter(val)
     return None
 
+
 def register_pretty_printer(objfile):
     """A routine to register a pretty-printer against the given OBJFILE.
     """
     objfile.pretty_printers.append(type_lookup_function)
 
+
 if __name__ == "__main__":
     if gdb.current_objfile() is not None:
         # This is the case where this script is being "auto-loaded"
-- 
2.7.4

                 reply	other threads:[~2018-06-27 19:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1530127899-7088-1-git-send-email-simon.marchi@ericsson.com \
    --to=simon.marchi@ericsson.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).