#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    6
    Rep Power
    0

    Help with pretty printing


    Hi
    I don't know if there is anyone on this forum who can help

    I am developing a set of gdb pretty printers for Qt
    A dictionary is built of the functions to call when a variable of a given type is detected
    Code:
    def build_dictionary ():
        pretty_printers_dict[re.compile ('^QFile$')] = lambda val:QFilePrinter(val,"false")
        pretty_printers_dict[re.compile ('^QFile \*$')] = lambda val: QFilePointerPrinter(val)
    Here I have declared handlers for the QFile and QFile * types

    In the QFile handler I have this code
    Code:
        exp = "((class QFile *)%s)->%s()" % (value.address, "exists")
    The problem is that this causes the handler for QFile * to be called which causes great problems

    If any Python guru knows how to overcome this I would appreciate it

    Thanks
  2. #2
  3. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,995
    Rep Power
    481
    Looks like c++ code is built. So I'm clueless, but remember "Any problem in computer science can be solved with another layer of indirection. But that usually will create another problem".
    [code]Code tags[/code] are essential for python code and Makefiles!

IMN logo majestic logo threadwatch logo seochat tools logo