3

I had some scripts in Python to help me debugging with GDB that used the function gdb.parse_and_eval (still documented) to get the inferior values from the arguments passed to a scripted command, and now the module doesn't seem to have any trace of that function. Doing python import gdb; print dir(gdb) from GDB clearly shows that this function is missing.

I wrote the scripts some time ago for the GDB 6.8 in the archer branch, and now I cannot find any information about if it's been deprecated or what happened in GDB 7.

Any information about it?

Thanks!

2 Answers 2

4

I don't know where it went or why, but Qt implemented this workaround in their code, which may be practically useful to you:

def parseAndEvaluate(exp):
        if gdb.VERSION.startswith("6.8.50.2009"):
            return gdb.parse_and_eval(exp)
        # Work around non-existing gdb.parse_and_eval as in released 7.0
        gdb.execute("set logging redirect on")
        gdb.execute("set logging on")
        gdb.execute("print %s" % exp)
        gdb.execute("set logging off")
        return gdb.history(0)
Sign up to request clarification or add additional context in comments.

Comments

4

parse_and_eval was checked in on the Archer branch, but has not been merged into mainline in time for 7.0 release. It has been merged now:

2009-12-03  Tom Tromey  <[email protected]>

        * python/python.c (gdbpy_parse_and_eval): New function.
        (GdbMethods): Add "parse_and_eval".

and will be available in the upcoming 7.1 release.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.