Hello, If I create a Python pretty-printer, it doesn't get updated in GUI using gdb. This is because the MI var doesn't get updated. To recreate: Download bug.c, bug.py which I will attach in a minute. > gcc -g bug.c > gdb --int mi2 (gdb) python execfile("bug.py") # Install pretty-printer for type "MyInt" (gdb) break main (gdb) run (gdb) next # do x = 3 (gdb) -var-create x * x (gdb) next # x = 5 (gdb) -var-update * # Doesn't report x changing. This was tested on a current CVS: 6.8.50.20090831 Thanks, Noam
Created attachment 4162 [details] C Source needed to recreate the bug
Created attachment 4163 [details] Python source needed to recreate the bug
Ok, here's a workaround/half-fix: Apply the patch. It simply comments out two lines which avoid updating a value which has a pretty printer and for which -var-list-children was not called. Python pretty-printers get updated without calling -var-list-children - the attached bug.py is an example. Now, use bug-workaround.py instead of bug.py. It seems that gdb doesn't update the value before getting its string. bug-workaround.py references and dereferences the value, with the effect of re-evaluating it.
Created attachment 4165 [details] Patch to half-fix the bug
Created attachment 4166 [details] Workaround which works when the patch is applied
This code has been extensively reworked on the python branch in the archer repository. We've also discussed the design quite a bit on the archer and gdb lists. If you could try that branch, it would help. We'll be pushing this code into CVS as soon as we all agree it is ready.
I just checked it with the archer-tromey-python branch, and it works with no workarounds needed!
Sorry, I was mistaken. The variable was updated because the pretty-printer wasn't used at all...
Ok. If I do -enable-pretty-printing (in the python branch), we return to the original bug - even bug-workaround doesn't work. :-(
I'm looking at it.
I fixed this on the archer-tromey-python branch.