Daniel Jacobowitz wrote: >> > } else { >> > >> > It wants to show the value in its variables window, not the reference. >> > So this patch would break it. >> > >> > So, should we change common_val_print, do you think? >> >> Short-term, this might be a solution. But note again that depending on >> textual "value" field is bad idea in any case. > > That's not actually what I meant - I'm not thinking of MI here. > common_val_print gets called from a number of places: > > - varobj c_value_of_variable, used by Insight and MI > (-var-list-children, -var-evaluate-expression, -var-assign, > -var-update). > > - print_frame_args, where it is used to deliberately print > only the address of a reference. I'm not entirely sure why. > > - Languages, to implement value_print - not relevant right now. It appears that 'common_val_print' has 'deref_ref' parameter which can be used to get back the old behaviour. However, then we'll again get no output if there's any undereferencable reference. I attach a patch that addresses this issue -- now, undereferencable references don't throw. For dereferencable references the value is printed after ":" as it is now. Changelog: 2006-04-04 Vladimir Prus * c-valprint.c (c_val_print): Explicitly check if a reference is dereferencable. * valops.c (value_at_maybe): New function * value.h (value_at_maybe): Export. * mi/mi-cmd-stack.c (list_args_or_locals): Use 'common_val_print', instead of 'print_value_value'. Remove code duplication. Patch is attached. - Volodya