Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH, c++ testsuite] Fix a few failures in gdb.cp/virtfunc.exp
@ 2013-06-03 12:31 Luis Machado
  2013-06-03 16:18 ` Tom Tromey
  0 siblings, 1 reply; 8+ messages in thread
From: Luis Machado @ 2013-06-03 12:31 UTC (permalink / raw)
  To: 'gdb-patches@sourceware.org'

[-- Attachment #1: Type: text/plain, Size: 951 bytes --]

Hi,

I noticed a few tests failing for ppc64. Those are related to printing 
virtual tables for objects.

Some of these failures are related to how the output from that command 
comes out in a target that uses function descriptors.

This is the regular non-function-descriptor output:

info vtbl a
vtable for 'A' @ 0x401858 (subobject @ 0x603220):
[0]: 0x400d9a <A::f()>

vtable for 'V' @ 0x401880 (subobject @ 0x603230):
[0]: 0x400ea2 <VB::vvb()>
[1]: 0x400e16 <V::vv()>

And the output for a target that does function descriptors:

info vtbl a
vtable for 'A' @ 0x10013518 (subobject @ 0x10013e20):
[0]: @0x10013b88: 0x10001c6c <A::f()>

vtable for 'V' @ 0x10013540 (subobject @ 0x10013e30):
[0]: @0x10013cd8: 0x10001f74 <VB::vvb()>
[1]: @0x10013c48: 0x10001df4 <V::vv()>

As you can see, there are additional fields for each virtual function 
pointer, and that is the address of the function descriptor.

The attached patch takes care of this.

OK?

[-- Attachment #2: vtbl_fd.diff --]
[-- Type: text/x-patch, Size: 694 bytes --]

2013-06-03  Luis Machado  <lgustavo@codesourcery.com>

	* gdb.cp/virtfunc.exp (make_one_vtable_result): Handle extra output
	from targets that use function descriptors in the virtual tables.

diff --git a/gdb/testsuite/gdb.cp/virtfunc.exp b/gdb/testsuite/gdb.cp/virtfunc.exp
index 2509cc7..4b73482 100644
--- a/gdb/testsuite/gdb.cp/virtfunc.exp
+++ b/gdb/testsuite/gdb.cp/virtfunc.exp
@@ -234,7 +234,7 @@ proc make_one_vtable_result {name args} {
     set result "vtable for '${name}' @ $hex .subobject @ $hex.:$nls"
     set count 0
     foreach func $args {
-	append result ".${count}.: $hex <$func..>${nls}"
+	append result ".${count}.:( @$hex:)? $hex <$func..>${nls}"
 	incr count
     }
 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH, c++ testsuite] Fix a few failures in gdb.cp/virtfunc.exp
  2013-06-03 12:31 [PATCH, c++ testsuite] Fix a few failures in gdb.cp/virtfunc.exp Luis Machado
@ 2013-06-03 16:18 ` Tom Tromey
  2013-06-04  8:53   ` Luis Machado
  0 siblings, 1 reply; 8+ messages in thread
From: Tom Tromey @ 2013-06-03 16:18 UTC (permalink / raw)
  To: lgustavo; +Cc: 'gdb-patches@sourceware.org'

>>>>> "Luis" == Luis Machado <lgustavo@codesourcery.com> writes:

Luis> 2013-06-03  Luis Machado  <lgustavo@codesourcery.com>
Luis> 	* gdb.cp/virtfunc.exp (make_one_vtable_result): Handle extra output
Luis> 	from targets that use function descriptors in the virtual tables.

Ok.  Thanks for looking at this.

Tom


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH, c++ testsuite] Fix a few failures in gdb.cp/virtfunc.exp
  2013-06-03 16:18 ` Tom Tromey
@ 2013-06-04  8:53   ` Luis Machado
  2013-06-04  9:03     ` Luis Machado
  2013-06-05 15:36     ` Tom Tromey
  0 siblings, 2 replies; 8+ messages in thread
From: Luis Machado @ 2013-06-04  8:53 UTC (permalink / raw)
  To: Tom Tromey; +Cc: 'gdb-patches@sourceware.org'

[-- Attachment #1: Type: text/plain, Size: 995 bytes --]

On 06/03/2013 06:17 PM, Tom Tromey wrote:
>>>>>> "Luis" == Luis Machado <lgustavo@codesourcery.com> writes:
>
> Luis> 2013-06-03  Luis Machado  <lgustavo@codesourcery.com>
> Luis> 	* gdb.cp/virtfunc.exp (make_one_vtable_result): Handle extra output
> Luis> 	from targets that use function descriptors in the virtual tables.
>
> Ok.  Thanks for looking at this.

Before checking in the patch, i figured out the rest of the problems.

Newer GDB's seem to have fixed a problem with displaying thunks in the 
virtual tables. Older ones did not demangle those names properly.

With that said, ppc64 uses dot symbols for those thunks, so we need to 
account for those in the testcase as well.

Here's the updated patch. I escaped dot once (\.) instead of twice. So 
hopefully this is the correct way. I often get confused with escaping in 
dejagnu.

With this fix, i see only a single failure for virtfunc.exp on ppc64. 
The other failure is more involved and i'm still chasing the root cause.

Luis


[-- Attachment #2: virtfunc_fix.diff --]
[-- Type: text/x-patch, Size: 732 bytes --]

2013-06-04  Luis Machado  <lgustavo@codesourcery.com>

	* gdb.cp/virtfunc.exp (make_one_vtable_result): Handle extra output
	from targets that use function descriptors in the virtual tables.
	Handle presence of dot symbols.

diff --git a/gdb/testsuite/gdb.cp/virtfunc.exp b/gdb/testsuite/gdb.cp/virtfunc.exp
index 2509cc7..1c2268a 100644
--- a/gdb/testsuite/gdb.cp/virtfunc.exp
+++ b/gdb/testsuite/gdb.cp/virtfunc.exp
@@ -234,7 +234,7 @@ proc make_one_vtable_result {name args} {
     set result "vtable for '${name}' @ $hex .subobject @ $hex.:$nls"
     set count 0
     foreach func $args {
-	append result ".${count}.: $hex <$func..>${nls}"
+	append result ".${count}.:( @$hex:)? $hex <(\.)?$func..>${nls}"
 	incr count
     }
 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH, c++ testsuite] Fix a few failures in gdb.cp/virtfunc.exp
  2013-06-04  8:53   ` Luis Machado
@ 2013-06-04  9:03     ` Luis Machado
  2013-06-04  9:10       ` Will Newton
  2013-06-05 15:36     ` Tom Tromey
  1 sibling, 1 reply; 8+ messages in thread
From: Luis Machado @ 2013-06-04  9:03 UTC (permalink / raw)
  Cc: Tom Tromey, 'gdb-patches@sourceware.org'

On 06/04/2013 10:53 AM, Luis Machado wrote:
> On 06/03/2013 06:17 PM, Tom Tromey wrote:
>>>>>>> "Luis" == Luis Machado <lgustavo@codesourcery.com> writes:
>>
>> Luis> 2013-06-03  Luis Machado  <lgustavo@codesourcery.com>
>> Luis>     * gdb.cp/virtfunc.exp (make_one_vtable_result): Handle extra
>> output
>> Luis>     from targets that use function descriptors in the virtual
>> tables.
>>
>> Ok.  Thanks for looking at this.
>
> Before checking in the patch, i figured out the rest of the problems.
>
> Newer GDB's seem to have fixed a problem with displaying thunks in the
> virtual tables. Older ones did not demangle those names properly.
>
> With that said, ppc64 uses dot symbols for those thunks, so we need to
> account for those in the testcase as well.
>
> Here's the updated patch. I escaped dot once (\.) instead of twice. So
> hopefully this is the correct way. I often get confused with escaping in
> dejagnu.
>
> With this fix, i see only a single failure for virtfunc.exp on ppc64.
> The other failure is more involved and i'm still chasing the root cause.

For convenience, here is an example of how the output looks for ppc64. 
Thunk symbols have a dot prefix.

vtable for 'D' @ 0x10013248 (subobject @ 0x10013ed0):
[0]: @0x10013c00: 0x10001d64 <.non-virtual thunk to E::vg()>
[1]: @0x10013ca8: 0x10001eec <D::vd()>

vtable for 'V' @ 0x10013290 (subobject @ 0x10013ef0):
[0]: @0x10013cd8: 0x10001f74 <VB::vvb()>
[1]: @0x10013c60: 0x10001e38 <.virtual thunk to E::vv()>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH, c++ testsuite] Fix a few failures in gdb.cp/virtfunc.exp
  2013-06-04  9:03     ` Luis Machado
@ 2013-06-04  9:10       ` Will Newton
  2013-06-04  9:18         ` Luis Machado
  0 siblings, 1 reply; 8+ messages in thread
From: Will Newton @ 2013-06-04  9:10 UTC (permalink / raw)
  To: lgustavo; +Cc: Tom Tromey, gdb-patches

On 4 June 2013 10:03, Luis Machado <lgustavo@codesourcery.com> wrote:
> On 06/04/2013 10:53 AM, Luis Machado wrote:
>>
>> On 06/03/2013 06:17 PM, Tom Tromey wrote:
>>>>>>>>
>>>>>>>> "Luis" == Luis Machado <lgustavo@codesourcery.com> writes:
>>>
>>>
>>> Luis> 2013-06-03  Luis Machado  <lgustavo@codesourcery.com>
>>> Luis>     * gdb.cp/virtfunc.exp (make_one_vtable_result): Handle extra
>>> output
>>> Luis>     from targets that use function descriptors in the virtual
>>> tables.
>>>
>>> Ok.  Thanks for looking at this.
>>
>>
>> Before checking in the patch, i figured out the rest of the problems.
>>
>> Newer GDB's seem to have fixed a problem with displaying thunks in the
>> virtual tables. Older ones did not demangle those names properly.
>>
>> With that said, ppc64 uses dot symbols for those thunks, so we need to
>> account for those in the testcase as well.
>>
>> Here's the updated patch. I escaped dot once (\.) instead of twice. So
>> hopefully this is the correct way. I often get confused with escaping in
>> dejagnu.
>>
>> With this fix, i see only a single failure for virtfunc.exp on ppc64.
>> The other failure is more involved and i'm still chasing the root cause.
>
>
> For convenience, here is an example of how the output looks for ppc64. Thunk
> symbols have a dot prefix.
>
> vtable for 'D' @ 0x10013248 (subobject @ 0x10013ed0):
> [0]: @0x10013c00: 0x10001d64 <.non-virtual thunk to E::vg()>
> [1]: @0x10013ca8: 0x10001eec <D::vd()>
>
> vtable for 'V' @ 0x10013290 (subobject @ 0x10013ef0):
> [0]: @0x10013cd8: 0x10001f74 <VB::vvb()>
> [1]: @0x10013c60: 0x10001e38 <.virtual thunk to E::vv()>

ARM also has a similar problem, as Thumb addresses end up looking like:

[0]: 0x8e7d <non-virtual thunk to E::vg()+1>

I'm not sure if it's a problem with the test or if there is a missing
call to addr_bits_remove somewhere.

--
Will Newton
Toolchain Working Group, Linaro


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH, c++ testsuite] Fix a few failures in gdb.cp/virtfunc.exp
  2013-06-04  9:10       ` Will Newton
@ 2013-06-04  9:18         ` Luis Machado
  0 siblings, 0 replies; 8+ messages in thread
From: Luis Machado @ 2013-06-04  9:18 UTC (permalink / raw)
  To: Will Newton; +Cc: Tom Tromey, gdb-patches

On 06/04/2013 11:10 AM, Will Newton wrote:
> On 4 June 2013 10:03, Luis Machado <lgustavo@codesourcery.com> wrote:
>> On 06/04/2013 10:53 AM, Luis Machado wrote:
>>>
>>> On 06/03/2013 06:17 PM, Tom Tromey wrote:
>>>>>>>>>
>>>>>>>>> "Luis" == Luis Machado <lgustavo@codesourcery.com> writes:
>>>>
>>>>
>>>> Luis> 2013-06-03  Luis Machado  <lgustavo@codesourcery.com>
>>>> Luis>     * gdb.cp/virtfunc.exp (make_one_vtable_result): Handle extra
>>>> output
>>>> Luis>     from targets that use function descriptors in the virtual
>>>> tables.
>>>>
>>>> Ok.  Thanks for looking at this.
>>>
>>>
>>> Before checking in the patch, i figured out the rest of the problems.
>>>
>>> Newer GDB's seem to have fixed a problem with displaying thunks in the
>>> virtual tables. Older ones did not demangle those names properly.
>>>
>>> With that said, ppc64 uses dot symbols for those thunks, so we need to
>>> account for those in the testcase as well.
>>>
>>> Here's the updated patch. I escaped dot once (\.) instead of twice. So
>>> hopefully this is the correct way. I often get confused with escaping in
>>> dejagnu.
>>>
>>> With this fix, i see only a single failure for virtfunc.exp on ppc64.
>>> The other failure is more involved and i'm still chasing the root cause.
>>
>>
>> For convenience, here is an example of how the output looks for ppc64. Thunk
>> symbols have a dot prefix.
>>
>> vtable for 'D' @ 0x10013248 (subobject @ 0x10013ed0):
>> [0]: @0x10013c00: 0x10001d64 <.non-virtual thunk to E::vg()>
>> [1]: @0x10013ca8: 0x10001eec <D::vd()>
>>
>> vtable for 'V' @ 0x10013290 (subobject @ 0x10013ef0):
>> [0]: @0x10013cd8: 0x10001f74 <VB::vvb()>
>> [1]: @0x10013c60: 0x10001e38 <.virtual thunk to E::vv()>
>
> ARM also has a similar problem, as Thumb addresses end up looking like:
>
> [0]: 0x8e7d <non-virtual thunk to E::vg()+1>
>
> I'm not sure if it's a problem with the test or if there is a missing
> call to addr_bits_remove somewhere.

Hum. I'd double check printcmd.c:build_address_symbolic to make sure it 
is doing the right thing.

I think E::vg(), E::vg()+2, E::vg()+3 is what should be displayed, correct?

Luis


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH, c++ testsuite] Fix a few failures in gdb.cp/virtfunc.exp
  2013-06-04  8:53   ` Luis Machado
  2013-06-04  9:03     ` Luis Machado
@ 2013-06-05 15:36     ` Tom Tromey
  2013-06-05 20:39       ` Luis Machado
  1 sibling, 1 reply; 8+ messages in thread
From: Tom Tromey @ 2013-06-05 15:36 UTC (permalink / raw)
  To: lgustavo; +Cc: 'gdb-patches@sourceware.org'

>>>>> "Luis" == Luis Machado <lgustavo@codesourcery.com> writes:

Luis> Here's the updated patch. I escaped dot once (\.) instead of twice. So
Luis> hopefully this is the correct way. I often get confused with escaping
Luis> in dejagnu.

This is ok.  Thanks.

Tom


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH, c++ testsuite] Fix a few failures in gdb.cp/virtfunc.exp
  2013-06-05 15:36     ` Tom Tromey
@ 2013-06-05 20:39       ` Luis Machado
  0 siblings, 0 replies; 8+ messages in thread
From: Luis Machado @ 2013-06-05 20:39 UTC (permalink / raw)
  To: Tom Tromey; +Cc: 'gdb-patches@sourceware.org'

On 06/05/2013 05:36 PM, Tom Tromey wrote:
>>>>>> "Luis" == Luis Machado <lgustavo@codesourcery.com> writes:
>
> Luis> Here's the updated patch. I escaped dot once (\.) instead of twice. So
> Luis> hopefully this is the correct way. I often get confused with escaping
> Luis> in dejagnu.
>
> This is ok.  Thanks.

Thanks. Committed now.

Luis


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-06-05 20:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-03 12:31 [PATCH, c++ testsuite] Fix a few failures in gdb.cp/virtfunc.exp Luis Machado
2013-06-03 16:18 ` Tom Tromey
2013-06-04  8:53   ` Luis Machado
2013-06-04  9:03     ` Luis Machado
2013-06-04  9:10       ` Will Newton
2013-06-04  9:18         ` Luis Machado
2013-06-05 15:36     ` Tom Tromey
2013-06-05 20:39       ` Luis Machado

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox