[OBV/PUSHED] testsuite: ovldbreak.exp: fix regexp

Message ID 20181019101257.31068-1-alan.hayward@arm.com
State New, archived
Headers

Commit Message

Alan Hayward Oct. 19, 2018, 10:12 a.m. UTC
  Fix the layout used in the regexp for breakpoints.

Fixes two FAILS.

2018-10-19  Alan Hayward  <alan.hayward@arm.com>

	* gdb.cp/ovldbreak.exp: Fix regexps.
---
 gdb/testsuite/gdb.cp/ovldbreak.exp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
  

Comments

Pedro Alves Oct. 19, 2018, 2:17 p.m. UTC | #1
On 10/19/2018 11:12 AM, Alan Hayward wrote:
> Fix the layout used in the regexp for breakpoints.
> 
> Fixes two FAILS.
> 

Curious, it doesn't fail for me.  What changed?

> 2018-10-19  Alan Hayward  <alan.hayward@arm.com>
> 
> 	* gdb.cp/ovldbreak.exp: Fix regexps.
Thanks,
Pedro Alves
  
Alan Hayward Oct. 19, 2018, 3:21 p.m. UTC | #2
> On 19 Oct 2018, at 15:17, Pedro Alves <palves@redhat.com> wrote:

> 

> On 10/19/2018 11:12 AM, Alan Hayward wrote:

>> Fix the layout used in the regexp for breakpoints.

>> 

>> Fixes two FAILS.

>> 

> 

> Curious, it doesn't fail for me.  What changed?


Two things:

Info breakpoint - the gaps between the fields. Some parts of the regexp
was just checking for 5 spaces, some parts were checking spaces+tabs.
It was also inconsistent throughout the .exp file - the exact same gaps
are checked differently. Made sure they were all spaces+tab checks.

On both x86 and aarch64, for the breakpoint at main, I get line 48 - the
“{“, instead of line 49, the first actual line of code. Allowed it to
have either. Maybe better fix would be to lookup the line number.


Alan.
  
Pedro Alves Oct. 19, 2018, 3:42 p.m. UTC | #3
On 10/19/2018 04:21 PM, Alan Hayward wrote:
> 
>> On 19 Oct 2018, at 15:17, Pedro Alves <palves@redhat.com> wrote:
>>
>> On 10/19/2018 11:12 AM, Alan Hayward wrote:
>>> Fix the layout used in the regexp for breakpoints.
>>>
>>> Fixes two FAILS.
>>>
>>
>> Curious, it doesn't fail for me.  What changed?
> 
> Two things:
> 
> Info breakpoint - the gaps between the fields. Some parts of the regexp
> was just checking for 5 spaces, some parts were checking spaces+tabs.
> It was also inconsistent throughout the .exp file - the exact same gaps
> are checked differently. Made sure they were all spaces+tab checks.

OK.

> On both x86 and aarch64, for the breakpoint at main, I get line 48 - the
> “{“, instead of line 49, the first actual line of code. Allowed it to
> have either. Maybe better fix would be to lookup the line number.

It's rare to see that these days, especially at -O0.
That might be some regression.  What compiler was that?

Thanks,
Pedro Alves
  
Alan Hayward Oct. 19, 2018, 4:03 p.m. UTC | #4
> On 19 Oct 2018, at 16:42, Pedro Alves <palves@redhat.com> wrote:

> 

> On 10/19/2018 04:21 PM, Alan Hayward wrote:

>> 

>>> On 19 Oct 2018, at 15:17, Pedro Alves <palves@redhat.com> wrote:

>>> 

>>> On 10/19/2018 11:12 AM, Alan Hayward wrote:

>>>> Fix the layout used in the regexp for breakpoints.

>>>> 

>>>> Fixes two FAILS.

>>>> 

>>> 

>>> Curious, it doesn't fail for me.  What changed?

>> 

>> Two things:

>> 

>> Info breakpoint - the gaps between the fields. Some parts of the regexp

>> was just checking for 5 spaces, some parts were checking spaces+tabs.

>> It was also inconsistent throughout the .exp file - the exact same gaps

>> are checked differently. Made sure they were all spaces+tab checks.

> 

> OK.

> 

>> On both x86 and aarch64, for the breakpoint at main, I get line 48 - the

>> “{“, instead of line 49, the first actual line of code. Allowed it to

>> have either. Maybe better fix would be to lookup the line number.

> 

> It's rare to see that these days, especially at -O0.

> That might be some regression.  What compiler was that?

> 


Would that be a bug in GDB or the compiler?

My setups are:

Aarch64 Ubuntu 16.04:
gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609

X86 Ubuntu 16.04:
gcc (Ubuntu 7.2.0-1ubuntu1~16.04) 7.2.0


I just tried it without my patch on 

Aarch64 Opensuse13.3 with
gcc (SUSE Linux) 7.2.1 20171020 [gcc-7-branch revision 253932]

Aarch64 centos7.4 with
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-16)

It passes on both of those. Looks like it could be an Ubuntu
issue then?


Alan.
  
Pedro Alves Oct. 19, 2018, 5:40 p.m. UTC | #5
On 10/19/2018 05:03 PM, Alan Hayward wrote:
> 
> 
>> On 19 Oct 2018, at 16:42, Pedro Alves <palves@redhat.com> wrote:
>>
>> On 10/19/2018 04:21 PM, Alan Hayward wrote:
>>>
>>>> On 19 Oct 2018, at 15:17, Pedro Alves <palves@redhat.com> wrote:
>>>>
>>>> On 10/19/2018 11:12 AM, Alan Hayward wrote:
>>>>> Fix the layout used in the regexp for breakpoints.
>>>>>
>>>>> Fixes two FAILS.
>>>>>
>>>>
>>>> Curious, it doesn't fail for me.  What changed?
>>>
>>> Two things:
>>>
>>> Info breakpoint - the gaps between the fields. Some parts of the regexp
>>> was just checking for 5 spaces, some parts were checking spaces+tabs.
>>> It was also inconsistent throughout the .exp file - the exact same gaps
>>> are checked differently. Made sure they were all spaces+tab checks.
>>
>> OK.
>>
>>> On both x86 and aarch64, for the breakpoint at main, I get line 48 - the
>>> “{“, instead of line 49, the first actual line of code. Allowed it to
>>> have either. Maybe better fix would be to lookup the line number.
>>
>> It's rare to see that these days, especially at -O0.
>> That might be some regression.  What compiler was that?
>>
> 
> Would that be a bug in GDB or the compiler?

Impossible to say off hand.  Could be either.

> 
> My setups are:
> 
> Aarch64 Ubuntu 16.04:
> gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
> 
> X86 Ubuntu 16.04:
> gcc (Ubuntu 7.2.0-1ubuntu1~16.04) 7.2.0
> 
> 
> I just tried it without my patch on 
> 
> Aarch64 Opensuse13.3 with
> gcc (SUSE Linux) 7.2.1 20171020 [gcc-7-branch revision 253932]
> 
> Aarch64 centos7.4 with
> gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-16)
> 
> It passes on both of those. Looks like it could be an Ubuntu
> issue then?

Ubuntu's gcc has some local changes, and enables some gcc options
by default that aren't enabled elsewhere.  So it could also be that
GDB is mishandling something that isn't well tested elsewhere.

Thanks,
Pedro Alves
  

Patch

diff --git a/gdb/testsuite/gdb.cp/ovldbreak.exp b/gdb/testsuite/gdb.cp/ovldbreak.exp
index 9a2efc115e..f3f329d293 100644
--- a/gdb/testsuite/gdb.cp/ovldbreak.exp
+++ b/gdb/testsuite/gdb.cp/ovldbreak.exp
@@ -208,11 +208,11 @@  for {set idx 0} {$idx < [llength $overloads]} {incr idx} {
 }
 
 # Verify the breakpoints.
-set bptable "Num     Type\[\t \]+Disp Enb Address\[\t \]+What.*"
-append bptable "\[0-9\]+\[\t \]+breakpoint     keep y\[\t \]+$hex\[\t \]+in main(\\((|void)\\))? at.*$srcfile:49\[\r\n\]+"
-append bptable "\[\t \]+breakpoint already hit 1 time\[\r\n\]+"
+set bptable "Num\[\t \]+Type\[\t \]+Disp Enb Address\[\t \]+What.*\[\r\n]+"
+append bptable "\[0-9\]+\[\t \]+breakpoint\[\t \]+keep\[\t \]y\[\t \]+$hex\[\t \]+in main(\\((|void)\\))? at.*$srcfile:4\[89\]\[\r\n\]+"
+append bptable "\[\t \]+breakpoint already hit 1 time\[\r\n\]+."
 foreach ovld $overloads {
-    append bptable [format "\[0-9\]+\[\t \]+breakpoint     keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(%s\\) at.*$srcfile:%d\[\r\n\]+" $ovld \
+    append bptable [format "\[0-9\]+\[\t \]+breakpoint\[\t \]+keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(%s\\) at.*$srcfile:%d\[\r\n\]+" $ovld \
 			$line($type_map("$ovld"))]
 }
 gdb_test "info break" $bptable "breakpoint info (after setting one-by-one)"
@@ -317,7 +317,7 @@  gdb_expect {
 }
 
 # Create the breakpoint table for "info breakpoint".
-set bptable "Num     Type\[\t \]+Disp Enb Address\[\t \]+What.*\[\r\n]+"
+set bptable "Num\[\t \]+Type\[\t \]+Disp Enb Address\[\t \]+What.*\[\r\n]+"
 append bptable "\[0-9\]+\[\t \]+breakpoint\[\t \]+keep\[\t \]y\[\t \]+<MULTIPLE>.*\[\r\n\]+"
 foreach ovld {void char signed_char unsigned_char short_int \
 		  unsigned_short_int int unsigned_int long_int \