Current File : //usr/share/gdb/python/gdb/command/type_printers.py
# Type printer commands.
# Copyright (C) 2010-2013 Free Software Foundation, Inc.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

import copy
import gdb

"""GDB commands for working with type-printers."""

class InfoTypePrinter(gdb.Command):
    """GDB command to list all registered type-printers.

    Usage: info type-printers
    """

    def __init__ (self):
        super(InfoTypePrinter, self).__init__("info type-printers",
                                              gdb.COMMAND_DATA)

    def list_type_printers(self, type_printers):
        """Print a list of type printers."""
        # A potential enhancement is to provide an option to list printers in
        # "lookup order" (i.e. unsorted).
        sorted_type_printers = sorted (copy.copy(type_printers),
                                       key = lambda x: x.name)
        for printer in sorted_type_printers:
            if printer.enabled:
                enabled = ''
            else:
                enabled = " [disabled]"
            print ("  %s%s" % (printer.name, enabled))

    def invoke(self, arg, from_tty):
        """GDB calls this to perform the command."""
        sep = ''
        for objfile in gdb.objfiles():
            if objfile.type_printers:
                print ("%sType printers for %s:" % (sep, objfile.filename))
                self.list_type_printers(objfile.type_printers)
                sep = '\n'
        if gdb.current_progspace().type_printers:
            print ("%sType printers for program space:" % sep)
            self.list_type_printers(gdb.current_progspace().type_printers)
            sep = '\n'
        if gdb.type_printers:
            print ("%sGlobal type printers:" % sep)
            self.list_type_printers(gdb.type_printers)

class _EnableOrDisableCommand(gdb.Command):
    def __init__(self, setting, name):
        super(_EnableOrDisableCommand, self).__init__(name, gdb.COMMAND_DATA)
        self.setting = setting

    def set_some(self, name, printers):
        result = False
        for p in printers:
            if name == p.name:
                p.enabled = self.setting
                result = True
        return result

    def invoke(self, arg, from_tty):
        """GDB calls this to perform the command."""
        for name in arg.split():
            ok = False
            for objfile in gdb.objfiles():
                if self.set_some(name, objfile.type_printers):
                    ok = True
            if self.set_some(name, gdb.current_progspace().type_printers):
                ok = True
            if self.set_some(name, gdb.type_printers):
                ok = True
            if not ok:
                print ("No type printer named '%s'" % name)

    def add_some(self, result, word, printers):
        for p in printers:
            if p.name.startswith(word):
                result.append(p.name)

    def complete(self, text, word):
        result = []
        for objfile in gdb.objfiles():
            self.add_some(result, word, objfile.type_printers)
        self.add_some(result, word, gdb.current_progspace().type_printers)
        self.add_some(result, word, gdb.type_printers)
        return result

class EnableTypePrinter(_EnableOrDisableCommand):
    """GDB command to enable the specified type printer.

    Usage: enable type-printer NAME

    NAME is the name of the type-printer.
    """

    def __init__(self):
        super(EnableTypePrinter, self).__init__(True, "enable type-printer")

class DisableTypePrinter(_EnableOrDisableCommand):
    """GDB command to disable the specified type-printer.

    Usage: disable type-printer NAME

    NAME is the name of the type-printer.
    """

    def __init__(self):
        super(DisableTypePrinter, self).__init__(False, "disable type-printer")

InfoTypePrinter()
EnableTypePrinter()
DisableTypePrinter()
blog

blog

– Официальный сайт Pinco Casino.2861 (2)

Пинко Казино – Официальный сайт Pinco Casino ▶️ ИГРАТЬ Содержимое Преимущества игры на официальном сайте Pinco Casino Безопасность и надежность Великий выбор иг Промокоды и бонусы Многоязычность Виды игр и слотов на официальном сайте Pinco Casino Бонусы и акции на официальном сайте Pinco Casino Входные бонусы Регулярные бонусы Как начать …

Read More »

1win официальный сайт букмекера — Обзор и зеркало для входа.3800

1win официальный сайт букмекера — Обзор и зеркало для входа ▶️ ИГРАТЬ Содержимое 1win Официальный Сайт Букмекера Преимущества официального сайта 1win Как зарегистрироваться на официальном сайте 1win Обзор и Зеркало для Входа Способ 1: Вход через официальный сайт Способ 2: Вход через зеркало Преимущества и Функции 1win В мире ставок …

Read More »

Plinko Casino Game Online – Enjoy High Stakes Action.331

Plinko Casino Game Online Experience High Stakes Thrills and Excitement ▶️ PLAY Содержимое Plinko Casino Game: Rules and Basics How to Play Plinko for Beginners Understanding the Plinko Board Tips for New Players Strategies to Maximize Your Winnings in Plinko Casino Game Online Choose the Right Plinko Online Game Manage …

Read More »

Betshop Τι ΠΡΕΠΕΙ να γνωρίζεις πριν παίξεις.4947

Betshop Τι ΠΡΕΠΕΙ να γνωρίζεις πριν παίξεις ▶️ ΠΑΊΖΩ Содержимое Betshop Τι ΠΡΕΠΕΙ – να γνωρίζεις πριν παίξεις Η σημασία της ενημέρωσης πριν από το στοίχημα Πώς να επιλέξετε το σωστό στοίχημα Τα πλεονεκτήματα του Betshop για τους παίκτες Συμβουλές για ασφαλή και υπεύθυνο παιχνίδι Γιατί το Betshop είναι η …

Read More »

Online kaszinók Magyarországon 2025-ben: Hogyan találhat biztonságos és nyereséges kaszinót

Online kaszinók Magyarországon 2025-ben: Hogyan találhat biztonságos és nyereséges kaszinót Magyarországon az online szerencsejáték gyorsan fejlődik, bevételei meghaladják a sportfogadásokét. Sok felhasználó kedveli az online kaszinókat kényelmük, széles játékválasztékuk és vonzó bónuszaik miatt. Azonban a kezdők könnyen elveszhetnek a sokféle webhely között. Hogy tudatos döntést hozhass, érdemes felkeresni a hungary-kaszino.com …

Read More »

казино – Официальный сайт Pin up играть онлайн Зеркало и вход.494

Пин Ап казино – Официальный сайт Pin up играть онлайн | Зеркало и вход ▶️ ИГРАТЬ Содержимое Официальный сайт Pin Up Казино: Как играть онлайн, зеркало и вход Pin Up Casino – Официальный сайт Описание и функции Pin Up Казино Бонусы и акции Как играть онлайн и вход в Pin …

Read More »

Beste Online Casinos in Deutschland.64

Beste Online Casinos in Deutschland ▶️ SPIELEN Содержимое Regulierung und Sicherheit Top Casino-Anbieter 1. Bwin 2. LeoVegas 3. Betway 4. 888 Casino 5. Casino.de Bonusangebote und Promotions No-Deposit-Bonus Einwilligungsbasierte Bonus Freispins Wiederholungsbasierte Bonus Spiele und Anpassung an Spieler Vielfältige Spielangebote Anpassungsfunktionen für Spieler Wenn es um das Vergnügen und die …

Read More »

91 Club Online Casino in India Demo Mode and Practice.211

91 Club Online Casino in India – Demo Mode and Practice ▶️ PLAY Содержимое 91 Club Online Casino in India: A Comprehensive Guide What is 91 Club Online Casino? Games and Features Unlock the Fun with Demo Mode and Practice Start Your Journey with a Bang: Exclusive Offers and Promotions …

Read More »

Best Online Casinos in Canada.947

Best Online Casinos in Canada ▶️ PLAY Содержимое Top-Rated Online Casinos in Canada Best Online Casinos with Free Bonus How to Choose the Best Online Casino for You Consider Your Budget Canada is known for its rich history of gaming and entertainment, and the online casino industry is no exception. …

Read More »