* cp-valprint.c (cp_print_value): Preserve offset if
the virtual base is outside of this object.
This commit is contained in:
parent
a02fd225ed
commit
b9d652ac99
2 changed files with 16 additions and 3 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2001-12-07 Daniel Jacobowitz <drow@mvista.com>
|
||||||
|
|
||||||
|
* cp-valprint.c (cp_print_value): Preserve offset if
|
||||||
|
the virtual base is outside of this object.
|
||||||
|
|
||||||
2001-12-07 Daniel Jacobowitz <drow@mvista.com>
|
2001-12-07 Daniel Jacobowitz <drow@mvista.com>
|
||||||
|
|
||||||
* gdbtypes.c (finish_cv_type): New function.
|
* gdbtypes.c (finish_cv_type): New function.
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include "gdb_string.h"
|
#include "gdb_string.h"
|
||||||
#include "c-lang.h"
|
#include "c-lang.h"
|
||||||
#include "target.h"
|
#include "target.h"
|
||||||
|
#include "cp-abi.h"
|
||||||
|
|
||||||
/* Indication of presence of HP-compiled object files */
|
/* Indication of presence of HP-compiled object files */
|
||||||
extern int hp_som_som_object_present; /* defined in symtab.c */
|
extern int hp_som_som_object_present; /* defined in symtab.c */
|
||||||
|
@ -504,6 +505,8 @@ cp_print_value (struct type *type, struct type *real_type, char *valaddr,
|
||||||
struct type **last_dont_print
|
struct type **last_dont_print
|
||||||
= (struct type **) obstack_next_free (&dont_print_vb_obstack);
|
= (struct type **) obstack_next_free (&dont_print_vb_obstack);
|
||||||
int i, n_baseclasses = TYPE_N_BASECLASSES (type);
|
int i, n_baseclasses = TYPE_N_BASECLASSES (type);
|
||||||
|
int thisoffset;
|
||||||
|
struct type *thistype;
|
||||||
|
|
||||||
if (dont_print_vb == 0)
|
if (dont_print_vb == 0)
|
||||||
{
|
{
|
||||||
|
@ -538,6 +541,8 @@ cp_print_value (struct type *type, struct type *real_type, char *valaddr,
|
||||||
obstack_ptr_grow (&dont_print_vb_obstack, baseclass);
|
obstack_ptr_grow (&dont_print_vb_obstack, baseclass);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
thisoffset = offset;
|
||||||
|
thistype = real_type;
|
||||||
if (TYPE_HAS_VTABLE (type) && BASETYPE_VIA_VIRTUAL (type, i))
|
if (TYPE_HAS_VTABLE (type) && BASETYPE_VIA_VIRTUAL (type, i))
|
||||||
{
|
{
|
||||||
/* Assume HP/Taligent runtime convention */
|
/* Assume HP/Taligent runtime convention */
|
||||||
|
@ -566,9 +571,12 @@ cp_print_value (struct type *type, struct type *real_type, char *valaddr,
|
||||||
|| (boffset + offset) >= TYPE_LENGTH (type)))
|
|| (boffset + offset) >= TYPE_LENGTH (type)))
|
||||||
{
|
{
|
||||||
base_valaddr = (char *) alloca (TYPE_LENGTH (baseclass));
|
base_valaddr = (char *) alloca (TYPE_LENGTH (baseclass));
|
||||||
if (target_read_memory (address + boffset, base_valaddr,
|
if (target_read_memory (address + offset + boffset, base_valaddr,
|
||||||
TYPE_LENGTH (baseclass)) != 0)
|
TYPE_LENGTH (baseclass)) != 0)
|
||||||
skip = 1;
|
skip = 1;
|
||||||
|
thisoffset = 0;
|
||||||
|
boffset = 0;
|
||||||
|
thistype = baseclass;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
base_valaddr = valaddr;
|
base_valaddr = valaddr;
|
||||||
|
@ -593,8 +601,8 @@ cp_print_value (struct type *type, struct type *real_type, char *valaddr,
|
||||||
if (skip >= 1)
|
if (skip >= 1)
|
||||||
fprintf_filtered (stream, "<invalid address>");
|
fprintf_filtered (stream, "<invalid address>");
|
||||||
else
|
else
|
||||||
cp_print_value_fields (baseclass, real_type, base_valaddr,
|
cp_print_value_fields (baseclass, thistype, base_valaddr,
|
||||||
offset + boffset, address, stream, format,
|
thisoffset + boffset, address, stream, format,
|
||||||
recurse, pretty,
|
recurse, pretty,
|
||||||
((struct type **)
|
((struct type **)
|
||||||
obstack_base (&dont_print_vb_obstack)),
|
obstack_base (&dont_print_vb_obstack)),
|
||||||
|
|
Loading…
Reference in a new issue