Create subobject value in pretty printer
Nowadays, we create a value of subobject in pretty printer with 'address' being used, value = value_from_contents_and_address (type, valaddr + embedded_offset, address + embedded_offset); set_value_component_location (value, val); /* set_value_component_location resets the address, so we may need to set it again. */ if (VALUE_LVAL (value) != lval_internalvar && VALUE_LVAL (value) != lval_internalvar_component && VALUE_LVAL (value) != lval_computed) set_value_address (value, address + embedded_offset); value_from_contents_and_address creates a value from memory, but the value we are pretty-printing may not from memory at all. Instead of using value_from_contents_and_address, we create a value of subobject with the same location as object's but different offset. We avoid using address in this way. As a result, parameter 'address' in apply_val_pretty_printer is no longer needed, we can remove it in next step. We've already had the location of the 'whole' value, so it is safe to assume we can create a value of 'component' or 'suboject' value at the same location but with different offset. gdb: 2016-11-21 Yao Qi <yao.qi@linaro.org> * guile/scm-pretty-print.c (gdbscm_apply_val_pretty_printer): Don't call value_from_contents_and_address and set_value_address. Call value_from_component. * python/py-prettyprint.c (gdbpy_apply_val_pretty_printer): Likewise. * value.c (value_from_component): New function. * value.h (value_from_component): Likewise. * valarith.c (value_subscripted_rvalue): Call value_from_component.
This commit is contained in:
parent
5689c9424b
commit
3fff9862d5
6 changed files with 42 additions and 36 deletions
|
@ -726,16 +726,7 @@ gdbpy_apply_val_pretty_printer (const struct extension_language_defn *extlang,
|
|||
cleanups = ensure_python_env (gdbarch, language);
|
||||
|
||||
/* Instantiate the printer. */
|
||||
value = value_from_contents_and_address (type, valaddr + embedded_offset,
|
||||
address + embedded_offset);
|
||||
|
||||
set_value_component_location (value, val);
|
||||
/* set_value_component_location resets the address, so we may
|
||||
need to set it again. */
|
||||
if (VALUE_LVAL (value) != lval_internalvar
|
||||
&& VALUE_LVAL (value) != lval_internalvar_component
|
||||
&& VALUE_LVAL (value) != lval_computed)
|
||||
set_value_address (value, address + embedded_offset);
|
||||
value = value_from_component (val, type, embedded_offset);
|
||||
|
||||
val_obj = value_to_value_object (value);
|
||||
if (! val_obj)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue