public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  archer-jankratochvil-misc: Improve the testcase gdb.base/lineno-makeup-func.c to PASS also on s390.
@ 2009-01-26  9:19 jkratoch
  0 siblings, 0 replies; only message in thread
From: jkratoch @ 2009-01-26  9:19 UTC (permalink / raw)
  To: archer-commits

The branch, archer-jankratochvil-misc has been updated
       via  a94bd75a6a33d2a5f284a848cfb04c115365a3cc (commit)
      from  a6ed408bab2c039e7056f9f961d60baaafed4895 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit a94bd75a6a33d2a5f284a848cfb04c115365a3cc
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Mon Jan 26 10:18:12 2009 +0100

    Improve the testcase gdb.base/lineno-makeup-func.c to PASS also on s390.

-----------------------------------------------------------------------

Summary of changes:
 .../{lineno-makeup.c => lineno-makeup-func.c}      |   15 +--------
 gdb/testsuite/gdb.base/lineno-makeup.c             |    7 +++-
 gdb/testsuite/gdb.base/lineno-makeup.exp           |   30 ++++++++++++++++---
 3 files changed, 32 insertions(+), 20 deletions(-)
 copy gdb/testsuite/gdb.base/{lineno-makeup.c => lineno-makeup-func.c} (66%)

First 500 lines of diff:
diff --git a/gdb/testsuite/gdb.base/lineno-makeup.c b/gdb/testsuite/gdb.base/lineno-makeup-func.c
similarity index 66%
copy from gdb/testsuite/gdb.base/lineno-makeup.c
copy to gdb/testsuite/gdb.base/lineno-makeup-func.c
index 1e7a501..1a0220e 100644
--- a/gdb/testsuite/gdb.base/lineno-makeup.c
+++ b/gdb/testsuite/gdb.base/lineno-makeup-func.c
@@ -15,18 +15,7 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-/* DW_AT_low_pc-DW_AT_high_pc should cover the function without line number
-   information (.debug_line) so we cannot use an external object file.
-   
-   It must not be just a label as it would alias on the next function even for
-   correct GDB.  Therefore a stub byte must be placed there.  */
-
-extern void func (void);
-asm ("func: .quad 0");
-
-int
-main (void)
+void
+func (void)
 {
-  func ();
-  return 0;
 }
diff --git a/gdb/testsuite/gdb.base/lineno-makeup.c b/gdb/testsuite/gdb.base/lineno-makeup.c
index 1e7a501..bb20e98 100644
--- a/gdb/testsuite/gdb.base/lineno-makeup.c
+++ b/gdb/testsuite/gdb.base/lineno-makeup.c
@@ -19,10 +19,13 @@
    information (.debug_line) so we cannot use an external object file.
    
    It must not be just a label as it would alias on the next function even for
-   correct GDB.  Therefore a stub byte must be placed there.  */
+   correct GDB.  Therefore some stub data must be placed there.
+   
+   We need to provide a real stub function body as at least s390
+   (s390_analyze_prologue) would skip the whole body till reaching `main'.  */
 
 extern void func (void);
-asm ("func: .quad 0");
+asm ("func: .incbin \"gdb.base/lineno-makeup-func.bin\"");
 
 int
 main (void)
diff --git a/gdb/testsuite/gdb.base/lineno-makeup.exp b/gdb/testsuite/gdb.base/lineno-makeup.exp
index c85c680..0c75b84 100644
--- a/gdb/testsuite/gdb.base/lineno-makeup.exp
+++ b/gdb/testsuite/gdb.base/lineno-makeup.exp
@@ -14,11 +14,26 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 set testfile "lineno-makeup"
+set srcfuncfile ${testfile}-func.c
 set srcfile ${testfile}.c
+set objfuncfile ${objdir}/${subdir}/${testfile}-func.o
+set binfuncfile ${objdir}/${subdir}/${testfile}-func.bin
 set binfile ${objdir}/${subdir}/${testfile}
 
-if { [prepare_for_testing ${testfile}.exp "${testfile}" "${testfile}.c" {debug}] } {
-    return -1
+if { [gdb_compile "${srcdir}/${subdir}/${srcfuncfile}" "${objfuncfile}" object {}] != "" } {
+    gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+set objcopy [catch "exec objcopy -O binary --only-section .text ${objfuncfile} ${binfuncfile}" output]
+verbose -log "objcopy=$objcopy: $output"
+if { $objcopy != 0 } {
+    gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+set binfuncfilesize [file size $binfuncfile]
+verbose -log "file size $binfuncfile = $binfuncfilesize"
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+    gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
 }
 
 gdb_exit
@@ -50,9 +65,14 @@ gdb_test_multiple $test $test {
 }
 verbose -log "p_addr=<$p_addr>"
 
-set test "break and print addresses match"
+set test "break address belongs to func"
 if {$b_addr == $p_addr} {
-    pass $test
+    pass "$test (exact match)"
 } else {
-    fail $test
+    set skip [expr $b_addr - $p_addr]
+    if {$skip > 0 && $skip < $binfuncfilesize} {
+	pass "$test (prologue skip by $skip bytes)"
+    } else {
+	fail $test
+    }
 }


hooks/post-receive
--
Repository for Project Archer.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-01-26  9:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-26  9:19 [SCM] archer-jankratochvil-misc: Improve the testcase gdb.base/lineno-makeup-func.c to PASS also on s390 jkratoch

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).