On Tue, Nov 8, 2016 at 2:01 PM, Ulrich Weigand wrote: > Yao Qi wrote: > >> If we go to the direction you suggested, val_print routines shouldn't >> assume that VAL contents are already fetched. Before we do printing, >> optimized-out checking, or available checking, we should make sure VAL >> is not lazy. Nowadays, we can't fetch the value partially, because >> 'lazy' is a bool attribute, we either fetched all contents or haven't >> fetch all contents. > > Right. But if we ever went to actually create sub-value objects, then > we might be able to take advantage of only fetching the contents for > those sub-objects are actually printed. In any case, I still think > this new patch is preferable over calling value_fetch_lazy all the > time ... > >> How is the patch below? I don't write the ChangeLog entry yet. >> Regression tested on x86_64-linux. > > Looks good to me. Thanks, I'll push it in. > >> --- a/gdb/extension.c >> +++ b/gdb/extension.c >> @@ -478,9 +478,9 @@ free_ext_lang_type_printers (struct ext_lang_type_print= >> ers *printers) >> xfree (printers); >> } >> =0C >> -/* Try to pretty-print a value of type TYPE located at VALADDR >> - + EMBEDDED_OFFSET, which came from the inferior at address ADDRESS >> - + EMBEDDED_OFFSET, onto stdio stream STREAM according to OPTIONS. >> +/* Try to pretty-print a value of type TYPE located at VAL's contents >> + buffer + EMBEDDED_OFFSET, which came from the inferior at address >> + ADDRESS + EMBEDDED_OFFSET, onto stdio stream STREAM according to OPTION= >> S. >> VAL is the whole object that came from ADDRESS. VALADDR must point to >> the head of VAL's contents buffer. >> Returns non-zero if the value was successfully pretty-printed. > > This changes the comment but not the actual implementation, this seems > to be an oversight? > It is a mistake in patch splitting. It is removed from this patch. Patch attached is pushed in, with ChangeLog entry. -- Yao (齐尧)