I am currently writing a Python GDB script. The problem is that it must be compatible with GDB 7.1. Therefore, I first wrote a script for GDB 7.3.1 and used the following function to get the output of the gdb command (GDB 7.3.1):
myvar = gdb.execute("info target", False, True)
The last parameter of this function is that it should return the result as a string (which makes sense, why else should I execute such a command;))
In GDB version 7.1, although it seems that the last parameter is unavailable , so this line (GDB 7.1):
myvar = gdb.execute("info target", False)
returns None .
Is there a chance to get the result of this team? I already tried to redirect the standard output of my python script to a file and then load this file, but apparently the standard input and output of my python script was overwritten by the gdb environment , so the output from the gdb.execute command is not written to my file.
The only thing I could think of was to wrap my script with a bash script, which first opens gdb with a python script that executes various commands and then transfers this to a file. Then open gdb again, but with a different python script that downloads the file, parses it, and then executes other commands based on input from the file and so on. But this is really the ugliest decision I can think of.
So, is there a way to get gdb.execute output in GDB 7.1?
source share