[PATCH 2/2] Testsuite for varobj updation after symbol removal

Taimoor tmirza@codesourcery.com
Thu Apr 23 08:05:00 GMT 2015


Hi Vladimir,

Thanks for reviewing the patch.

On 04/17/2015 08:18 PM, Vladimir Prus wrote:
>
>
> On 04/16/2015 06:32 AM, Taimoor Mirza wrote:
>  > This patch provides testcases for variable object updation after
> removing
>  > symbols. Test programs are same as used for testing remove-symbol-file
>  > command in gdb.base. sym-file-main.c is modified to just add a global
>  > variable for which varible object is created in testsuite.
>  >
>
> Taimoor,
>
> thanks for the patch, and testsuite change. Looking at it, it appears
> that 'count' is
> a global variable, and it's modified in one place, in the main function,
> and after that
> you do 'remove-symbol-files' and verify that var-update reports reports
> 'count' as
> changed. But what does it test exactly? Since count is explicitly
> modified in the
> test, I'd imagine that -var-update will report it as changed even without
> 'remove-symbol-file'. In other words, does this testcase fail if the
> code patch is not
> applied?

Yes. This testcase fails without applying this patch. Below is 
problematic scenario:


1) Run GDB session and load symbols from file a.
2) Create varobj for some global variable test.
3) put some breakpoint in some function and run to that breakpoint.
4) Use add-symbol-file to load symbols of file b.
5) Put breakpoint on some other function that is called after updating
global variable test.
6) When this breakpoint gets hit, remove symbols of b using
'remove-symbol-file'.
7) print value of test. Its updated and different from initial value.
8) give 'var-update' command for variable object of 'test' and
changelist will be empty.

I know its not a common scenario but as long as it is valid
according to individual command specifications we have all the right to
expect it will produce the intended results.

>
> Even if so, does it test exactly what is your real case? It's easy to
> see why 'remove-symbol-files'
> can make some global variables no longer present. But how it can change
> value of some expression?

Its not the case of global variable not present. Its problem with 
properly displaying changeset for a valid global variable whose value is 
changed.
Step 7 in above scenario displays updated value of variable but 
-var-update for varobj of that variable gives empty changeset. The 
reason for this is mentioned in source code patch [PATCH 1/2].
>
> Thanks,
> Volodya
>



More information about the Gdb-patches mailing list