This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] varobj deletion after the binary has changed


 >    /* sanity check: have we been passed a pointer? */
 >    if (changelist == NULL)
 > -    return -1;
 > +    return WRONG_PARAM;
 >  
 >    /*  Only root variables can be updated... */
 >    if (!is_root_p (*varp))
 >      /* Not a root var */
 > -    return -1;
 > +    return WRONG_PARAM;
 > +
 > +  if (!(*varp)->root->is_valid)
 > +    return INVALID;

OK I hadn't noticed the distinction between WRONG_PARAM and INVALID.  I think
it would be better to throw an error in the case of WRONG_PARAM, otherwise
changes to leaf values may go unnoticed.  But this is a separate change.

I've not checked the test but I think the English could be improved and
different names used:

>  ...
> # Verify that once binary file has changed, GDB correctly handles
> # previously defined MI variables.

# Verify that once binary file has changed, GDB correctly handles
# previously defined MI variable objects.

 > ...
 > #
 > # reload the same binary
 > # global variable must be keeped, other invalidated

 # Reload the same binary.
 # Global variable should remain, local should be invalidated.

 > #
 > mi_delete_breakpoints
 > mi_gdb_load ${binfile_bis}
 > mi_runto main

 > # Check local variable are "invalid"

 # Check local variable is "invalid"

 > mi_gdb_test "-var-update linteger" \
 > 	"\\^done,changelist=\\\[\{name=\"linteger\",in_scope=\"invalid\"\}\\\]" \
 > 	"linteger not anymore in scope due to binary changes"
 > 
 > mi_gdb_test "-var-info-type linteger" \
 > 	"\\^done,type=\"\"" \
 > 	"not type for invalid variable linteger"

 "no type for invalid variable linteger (1)"

 > # Check global variable are still correct.
 > mi_gdb_test "-var-update global_simple" \
 > 	"\\^done,changelist=\\\[\]" \
 > 	"global_simple still alive"
 > 
 > mi_gdb_test "-var-info-type global_simple" \
 > 	"\\^done,type=\"simpleton\"" \
 > 	"type simpleton for valid variable global_simple"
 > 
 > 
 > #
 > # load an other binary
 > # all variables must be invalidated

I guess capital letters at the start and full stops.

 > mi_delete_breakpoints
 > mi_gdb_load ${binfile2}
 > # Check local variable are "invalid"
 > mi_gdb_test "-var-update linteger" \
 > 	"\\^done,changelist=\\\[\{name=\"linteger\",in_scope=\"invalid\"\}\\\]" \
 > 	"linteger not valid anymore due to binary changes"
 > 
 > mi_gdb_test "-var-info-type linteger" \
 > 	"\\^done,type=\"\"" \
 > 	"not type for invalid variable linteger"

 "no type for invalid variable linteger (2)"
 > 
 > # Check global variable are still correct.
 > mi_gdb_test "-var-update global_simple" \
 > 	"\\^done,changelist=\\\[\{name=\"global_simple\",in_scope=\"invalid\"\}\\\]" \
 > 	"global_simple not anymore in scope due to binary changes"
 > 
 > mi_gdb_test "-var-info-type global_simple" \
 > 	"\\^done,type=\"\"" \
 > 	"not type for invalid variable global_simple"
 > 
 
 "no type for invalid variable global_simple"

 > mi_gdb_exit
 > return 0

-- 
Nick                                           http://www.inet.net.nz/~nickrob


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]