public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [testsuite patch] Fix recent GCC FAIL: gdb.arch/i386-signal.exp
@ 2016-10-03 20:35 Jan Kratochvil
  2016-10-04 16:08 ` Yao Qi
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Kratochvil @ 2016-10-03 20:35 UTC (permalink / raw)
  To: gdb-patches

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

Hi,

gcc-6.2.1-2.fc24.x86_64

(gdb) backtrace 10^M
#0  func () at .../gdb/testsuite/gdb.arch/i386-signal.c:26^M
#1  <signal handler called>^M
#2  0x0000000000400588 in main () at .../gdb/testsuite/gdb.arch/i386-signal.c:31^M
(gdb) FAIL: gdb.arch/i386-signal.exp: backtrace 10

(gdb) disas/s
Dump of assembler code for function main:
.../gdb/testsuite/gdb.arch/i386-signal.c:
30      {
   0x000000000040057f <+0>:     push   %rbp
   0x0000000000400580 <+1>:     mov    %rsp,%rbp
31        setup ();
   0x0000000000400583 <+4>:     callq  0x400590 <setup>
=> 0x0000000000400588 <+9>:     mov    $0x0,%eax
32      }
   0x000000000040058d <+14>:    pop    %rbp
   0x000000000040058e <+15>:    retq
End of assembler dump.

The two attached patch chunks each fixes the FAIL on its own.

The .exp patch is an obvious typo fix I think.  The regex was written to
accept "ADDR in main" and I find it OK as checking .debug_line validity is not
the purpose of this testfile.

The .c patch will properly create a new corresponding source line .debug_line
entry for the 'mov $0x0,%eax' instruction and I also do not think it is
relevant to the purpose of this testfile.

gcc-4.8.5-11.el7.x86_64 did not put the 'mov $0x0,%eax' instruction there at
all so there was no problem with .debug_line.

Tested on {x86_64,x86_64-m32}-fedora24-linux-gnu.

OK to check it in?


Thanks,
Jan

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

gdb/testsuite/ChangeLog
2016-10-03  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gdb.arch/i386-signal.c (main): Add return 0.
	* gdb.arch/i386-signal.exp (backtrace 10): Fix #2 typo.

diff --git a/gdb/testsuite/gdb.arch/i386-signal.c b/gdb/testsuite/gdb.arch/i386-signal.c
index c5a311e..c168d56 100644
--- a/gdb/testsuite/gdb.arch/i386-signal.c
+++ b/gdb/testsuite/gdb.arch/i386-signal.c
@@ -29,6 +29,7 @@ int
 main (void)
 {
   setup ();
+  return 0;
 }
 
 /* Create an imitation signal frame.  This will work on any x86 or
diff --git a/gdb/testsuite/gdb.arch/i386-signal.exp b/gdb/testsuite/gdb.arch/i386-signal.exp
index 276b7c0..51a3a25 100644
--- a/gdb/testsuite/gdb.arch/i386-signal.exp
+++ b/gdb/testsuite/gdb.arch/i386-signal.exp
@@ -35,6 +35,6 @@ gdb_load ${binfile}
 
 runto func
 gdb_test "backtrace 10" \
-    "#0  ($hex in )?func.*\r\n#1  <signal handler called>\r\n#2  ($hex in)?main.*"
+    "#0  ($hex in )?func.*\r\n#1  <signal handler called>\r\n#2  ($hex in )?main.*"
 
 gdb_test "finish" "Run till exit from \#0  func.*<signal handler called>"

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

* Re: [testsuite patch] Fix recent GCC FAIL: gdb.arch/i386-signal.exp
  2016-10-03 20:35 [testsuite patch] Fix recent GCC FAIL: gdb.arch/i386-signal.exp Jan Kratochvil
@ 2016-10-04 16:08 ` Yao Qi
  2016-10-04 16:19   ` Jan Kratochvil
  0 siblings, 1 reply; 6+ messages in thread
From: Yao Qi @ 2016-10-04 16:08 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb-patches

On Mon, Oct 3, 2016 at 9:35 PM, Jan Kratochvil
<jan.kratochvil@redhat.com> wrote:
> The two attached patch chunks each fixes the FAIL on its own.
>
> The .exp patch is an obvious typo fix I think.  The regex was written to
> accept "ADDR in main" and I find it OK as checking .debug_line validity is not
> the purpose of this testfile.
>

This is reasonable to me.

> The .c patch will properly create a new corresponding source line .debug_line
> entry for the 'mov $0x0,%eax' instruction and I also do not think it is
> relevant to the purpose of this testfile.
>

Why do we need the second one?

-- 
Yao (齐尧)

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

* Re: [testsuite patch] Fix recent GCC FAIL: gdb.arch/i386-signal.exp
  2016-10-04 16:08 ` Yao Qi
@ 2016-10-04 16:19   ` Jan Kratochvil
  2016-10-04 16:39     ` Jan Kratochvil
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Kratochvil @ 2016-10-04 16:19 UTC (permalink / raw)
  To: Yao Qi; +Cc: gdb-patches

On Tue, 04 Oct 2016 18:07:56 +0200, Yao Qi wrote:
> > The .c patch will properly create a new corresponding source line .debug_line
> > entry for the 'mov $0x0,%eax' instruction and I also do not think it is
> > relevant to the purpose of this testfile.
> 
> Why do we need the second one?

I find it more cleaner but that is up to you.


Jan

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

* Re: [testsuite patch] Fix recent GCC FAIL: gdb.arch/i386-signal.exp
  2016-10-04 16:19   ` Jan Kratochvil
@ 2016-10-04 16:39     ` Jan Kratochvil
  2016-10-05  8:15       ` Yao Qi
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Kratochvil @ 2016-10-04 16:39 UTC (permalink / raw)
  To: Yao Qi; +Cc: gdb-patches

On Tue, 04 Oct 2016 18:19:00 +0200, Jan Kratochvil wrote:
> On Tue, 04 Oct 2016 18:07:56 +0200, Yao Qi wrote:
> > > The .c patch will properly create a new corresponding source line .debug_line
> > > entry for the 'mov $0x0,%eax' instruction and I also do not think it is
> > > relevant to the purpose of this testfile.
> > 
> > Why do we need the second one?
> 
> I find it more cleaner but that is up to you.

To make that my reason more explanatory - given the testcase expected output
is affected by that missing "return 0;" and its .debug_line record I find it
more clear for this testcase to put there the source line "return 0;"
explicitly than to depend on such implicit line by compiler as then the debug
info is unclear for that line - even among different compilers.


Jan

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

* Re: [testsuite patch] Fix recent GCC FAIL: gdb.arch/i386-signal.exp
  2016-10-04 16:39     ` Jan Kratochvil
@ 2016-10-05  8:15       ` Yao Qi
  2016-10-05 19:59         ` [commit] " Jan Kratochvil
  0 siblings, 1 reply; 6+ messages in thread
From: Yao Qi @ 2016-10-05  8:15 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb-patches

On Tue, Oct 4, 2016 at 5:39 PM, Jan Kratochvil
<jan.kratochvil@redhat.com> wrote:
> On Tue, 04 Oct 2016 18:19:00 +0200, Jan Kratochvil wrote:
>> On Tue, 04 Oct 2016 18:07:56 +0200, Yao Qi wrote:
>> > > The .c patch will properly create a new corresponding source line .debug_line
>> > > entry for the 'mov $0x0,%eax' instruction and I also do not think it is
>> > > relevant to the purpose of this testfile.
>> >
>> > Why do we need the second one?
>>
>> I find it more cleaner but that is up to you.
>
> To make that my reason more explanatory - given the testcase expected output
> is affected by that missing "return 0;" and its .debug_line record I find it
> more clear for this testcase to put there the source line "return 0;"
> explicitly than to depend on such implicit line by compiler as then the debug
> info is unclear for that line - even among different compilers.
>

We need the first chunk "($hex in )?main" because the unwind pc may point
to the first instruction of a source line or the non-first instruction
of a line.
Either is possible.   It doesn't matter that "callq  setup" and
"mov    $0x0,%eax" are mapped to the same line or not.

Change in gdb.arch/i386-signal.exp is good to me, but change
in gdb.arch/i386-signal.c is not necessary.

-- 
Yao (齐尧)

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

* [commit] [testsuite patch] Fix recent GCC FAIL: gdb.arch/i386-signal.exp
  2016-10-05  8:15       ` Yao Qi
@ 2016-10-05 19:59         ` Jan Kratochvil
  0 siblings, 0 replies; 6+ messages in thread
From: Jan Kratochvil @ 2016-10-05 19:59 UTC (permalink / raw)
  To: Yao Qi; +Cc: gdb-patches

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

On Wed, 05 Oct 2016 10:15:08 +0200, Yao Qi wrote:
> We need the first chunk "($hex in )?main" because the unwind pc may point
> to the first instruction of a source line or the non-first instruction
> of a line.
> Either is possible.   It doesn't matter that "callq  setup" and
> "mov    $0x0,%eax" are mapped to the same line or not.
> 
> Change in gdb.arch/i386-signal.exp is good to me, but change
> in gdb.arch/i386-signal.c is not necessary.

Checked in.


Jan

[-- Attachment #2: Type: message/rfc822, Size: 2251 bytes --]

From: Jan Kratochvil <jan.kratochvil@redhat.com>
Subject: [PATCH] testsuite: Fix recent GCC FAIL: gdb.arch/i386-signal.exp
Date: Wed, 5 Oct 2016 21:56:46 +0200

gcc-6.2.1-2.fc24.x86_64

(gdb) backtrace 10^M
(gdb) FAIL: gdb.arch/i386-signal.exp: backtrace 10

(gdb) disas/s
Dump of assembler code for function main:
.../gdb/testsuite/gdb.arch/i386-signal.c:
30      {
   0x000000000040057f <+0>:     push   %rbp
   0x0000000000400580 <+1>:     mov    %rsp,%rbp
31        setup ();
   0x0000000000400583 <+4>:     callq  0x400590 <setup>
=> 0x0000000000400588 <+9>:     mov    $0x0,%eax
32      }
   0x000000000040058d <+14>:    pop    %rbp
   0x000000000040058e <+15>:    retq
End of assembler dump.

The .exp patch is an obvious typo fix I think.  The regex was written to
accept "ADDR in main" and I find it OK as checking .debug_line validity is not
the purpose of this testfile.

gcc-4.8.5-11.el7.x86_64 did not put the 'mov $0x0,%eax' instruction there at
all so there was no problem with .debug_line.

gdb/testsuite/ChangeLog
2016-10-05  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gdb.arch/i386-signal.exp (backtrace 10): Fix #2 typo.
---
 gdb/testsuite/ChangeLog                | 4 ++++
 gdb/testsuite/gdb.arch/i386-signal.exp | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 537ca8c..cbea3b2 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2016-10-05  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	* gdb.arch/i386-signal.exp (backtrace 10): Fix #2 typo.
+
 2016-10-05  Yao Qi  <yao.qi@linaro.org>
 
 	* lib/gdb.exp (support_complex_tests): Return zero if
diff --git a/gdb/testsuite/gdb.arch/i386-signal.exp b/gdb/testsuite/gdb.arch/i386-signal.exp
index 276b7c0..51a3a25 100644
--- a/gdb/testsuite/gdb.arch/i386-signal.exp
+++ b/gdb/testsuite/gdb.arch/i386-signal.exp
@@ -35,6 +35,6 @@ gdb_load ${binfile}
 
 runto func
 gdb_test "backtrace 10" \
-    "#0  ($hex in )?func.*\r\n#1  <signal handler called>\r\n#2  ($hex in)?main.*"
+    "#0  ($hex in )?func.*\r\n#1  <signal handler called>\r\n#2  ($hex in )?main.*"
 
 gdb_test "finish" "Run till exit from \#0  func.*<signal handler called>"
-- 
2.7.4

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

end of thread, other threads:[~2016-10-05 19:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-03 20:35 [testsuite patch] Fix recent GCC FAIL: gdb.arch/i386-signal.exp Jan Kratochvil
2016-10-04 16:08 ` Yao Qi
2016-10-04 16:19   ` Jan Kratochvil
2016-10-04 16:39     ` Jan Kratochvil
2016-10-05  8:15       ` Yao Qi
2016-10-05 19:59         ` [commit] " Jan Kratochvil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).