Red Hat ENTERPRISE LINUX 3 - DEVELOPER TOOLS GUIDE Guide de l'utilisateur Page 70

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 100
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 69
Chapter 5. Debugging
60
To address this, the Red Hat Enterprise Linux 6 version of GDB is now compatible with Python pretty-
printers. This allows the retrieval of more meaningful debugging data by leaving the introspection,
printing, and formatting logic to a third-party Python script.
Compatibility with Python pretty-printers gives you the chance to truly customize GDB output as you
see fit. This makes GDB a more viable debugging solution to a wider range of projects, since you now
have the flexibility to adapt GDB output as needed, and with greater ease. Further, developers with
intimate knowledge of a project and a specific programming language are best qualified in deciding
what kind of output is meaningful, allowing them to improve the usefulness of that output.
The Python pretty-printers implementation allows users to automatically inspect, format, and print
program data according to specification. These specifications are written as rules implemented via
Python scripts. This offers the following benefits:
Safe
To pass program data to a set of registered Python pretty-printers, the GDB development team added
hooks to the GDB printing code. These hooks were implemented with safety in mind: the built-in
GDB printing code is still intact, allowing it to serve as a default fallback printing logic. As such, if
no specialized printers are available, GDB will still print debugging data the way it always did. This
ensures that GDB is backwards-compatible; users who have no need of pretty-printers can still
continue using GDB.
Highly Customizable
This new "Python-scripted" approach allows users to distill as much knowledge as required into
specific printers. As such, a project can have an entire library of printer scripts that parses program
data in a unique manner specific to its user's needs. There is no limit to the number of printers a user
can build for a specific project; what's more, being able to customize debugging data script by script
offers users an easier way to re-use and re-purpose printer scripts — or even a whole library of them.
Easy to Learn
The best part about this approach is its lower barrier to entry. Python scripting is quite easy to learn
(in comparison, at least) and has a large library of free documentation available online. In addition,
most programmers already have basic to intermediate experience in Python scripting, or in scripting in
general.
The GDB and Python Pretty-Printers whitepaper provides more details on this feature. This whitepaper
also includes details and examples on how to write your own Python pretty-printer as well as how to
import it into GDB. Refer to the following link for more information:
http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/
GDB_and_Python_Pretty_Printers/
Vue de la page 69
1 2 ... 65 66 67 68 69 70 71 72 73 74 75 ... 99 100

Commentaires sur ces manuels

Pas de commentaire