[PATCH] Fix inherit.exp tests

Yao Qi qiyaoltc@gmail.com
Tue Oct 6 14:43:00 GMT 2015


Andrew Stubbs <ams@codesourcery.com> writes:

Hi Andrew,

> Some of the tests in inherit.exp make invalid assumptions about vtable
> pointers in printed values.
>
> I find that these tests pass on most targets, but fail on a few
> targets, including mips-sde.

I think there are some fails in gdb.cp/virtbase.exp of this kind.  Did
you see them on mips?  They fail on aarch64 (and nios2 IIRC).

>
> The reason is that the "_vptr" entries in C++ types do not point to
> the head of the vtable, but point to the address following the last
> entry in the table, which mean that when GDB prints the symbol

I think you are right.  IIUC, negative index is used to identify the
vptr, but I am not very sure, still need some time to understand c++ stuff.

> associated with the address, it actually prints the name of the value
> that follows the table in memory.
>
> Historically, it appears to have been fairly predictable what symbol
> would follow the vtable, and remains so on most targets, but this is
> no longer true in general (or perhaps never was). In mips-sde, in
> particular, the "VTT for *" symbols are placed in a completely
> different section, so cannot follow the vtable. The alignment and
> padding appears to have varied slightly, and the order of vtable and
> typeinfo sections appears to have varied also (or maybe the test was
> never right?)
>
> The attached patch adds new expect patterns that don't require any
> specific symbol at all, since they're basically meaningless.

I probably need several days to investigate VTT, vptr table and etc.
Ping us if you don't get response from me in one week.

-- 
Yao (齐尧)



More information about the Gdb-patches mailing list