Denis PILAT wrote: > Daniel Jacobowitz wrote: >> On Tue, Jan 23, 2007 at 01:32:22PM +0100, Denis PILAT wrote: >> >>> Hi, >>> >>> We have a bug in one of our gdb target, when the binary changed >>> while beeing debugged it appears that some of our varobj refers to >>> invalid symbols or type. >>> >>> I propose a patch that delete all varobj when symbols are reloaded. >>> May be there is a better place to do that but I think we must do >>> that somewhere, don't you ? >>> >> >> The right thing to do is probably to figure out where the >> invalid references come from and fix them - probably by re-evaluating >> expressions at the next -var-update. Deleting things behind the front >> end's back is a bad policy. >> >> >> > Deleting all is a little bit radical, I can understand that. > Re-evaluating expression would give the expected thing for globale > variables, but for varobj that has been set on local variable (so > within a "valid_block"), it should have side effects: the evaluation > of the expression might tied the varobj to a variable different than > the one the user originally decided. > > I propose to distinguish 2 cases > - varobj on global variable (valid_block == null) must have their > expression re-evaluated. > - other one must be put in a kind of invalid state that will gives > "in_scope="false" to the user. > This last point will involve a new field in varobj structure, I > haven't seen something to mark varobj as invalid. > > Denis > Hi Attached is a new patch proposal when I implemented what I explained above. During the symbol re-loading I invalidate varobjs linked to locals variable and try to re-evaluate the expression for globals. No more varobjs are deleted, and during varobj_update invalidated symbols are skipped so displayed as not in scope. If you're fine with this implementation I'll write 2 more test cases in the testsuite that lead to segmentation fault in the current GDB: - one where the binary file completely changed so any varobjs defined on global variable are invalidated. - one where the binary file is just updated so varobjs on globals can still be evaluated. I check the testsuite with i386-linux target with no regression and I passed a valgrind as well. -- Denis PILAT STMicroelectronics