From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28540 invoked by alias); 1 May 2005 04:36:01 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 28526 invoked from network); 1 May 2005 04:35:54 -0000 Received: from unknown (HELO e34.co.us.ibm.com) (32.97.110.132) by sourceware.org with SMTP; 1 May 2005 04:35:54 -0000 Received: from d03relay04.boulder.ibm.com (d03relay04.boulder.ibm.com [9.17.195.106]) by e34.co.us.ibm.com (8.12.10/8.12.9) with ESMTP id j414ZseE201622 for ; Sun, 1 May 2005 00:35:54 -0400 Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by d03relay04.boulder.ibm.com (8.12.10/NCO/VER6.6) with ESMTP id j414Zr1q189382 for ; Sat, 30 Apr 2005 22:35:54 -0600 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.12.11/8.13.3) with ESMTP id j414Zr7b004356 for ; Sat, 30 Apr 2005 22:35:53 -0600 Received: from imap.linux.ibm.com (imap.rtp.raleigh.ibm.com [9.42.107.100]) by d03av04.boulder.ibm.com (8.12.11/8.12.11) with ESMTP id j414ZVWU004185; Sat, 30 Apr 2005 22:35:53 -0600 Received: by imap.linux.ibm.com (Postfix, from userid 48) id B4B557C009; Sun, 1 May 2005 00:35:31 -0400 (EDT) Received: from sig-9-65-98-23.mts.ibm.com (sig-9-65-98-23.mts.ibm.com [9.65.98.23]) by imap.rtp.raleigh.ibm.com (IMP) with HTTP for ; Sun, 1 May 2005 00:35:31 -0400 Message-ID: <1114922131.42745c938ed3a@imap.linux.ibm.com> Date: Sun, 01 May 2005 04:36:00 -0000 From: Wu Zhou To: Daniel Jacobowitz Cc: pgilliam@us.ibm.com, gdb-patches@sources.redhat.com Subject: Re: [patch] update gdb.base/shreloc.exp to use new shared library infrastructure MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.7 X-SW-Source: 2005-05/txt/msg00004.txt.bz2 > > Can we fix the testcase instead of adding -qdbxextra, by making the > > variable referenced? Other compilers do the same optimization, and > > some of them don't have a handy option to preserve the variable. > > > > Is it ok to change the following lines in shreloc1.c/shreloc2.c from: > > ATTRIBUTES void fn_1 (int unused) { } > ATTRIBUTES void fn_2 (int unused) { } > > to: > > ATTRIBUTES void fn_1 (int refered) { static_var_1 = refered; } > ATTRIBUTES void fn_2 (int refered) { static_var_2 = refered; } > > Please comments. Thanks. Here goes the revised patch. Wishing that it will not get mangled any more. Please review and comments. 2005-05-01 Paul Gilliam Wu Zhou * gdb.base/shreloc.exp: Use gdb_compile_shlib. Add support for IBM's xlc compiler. * gdb.base/shreloc1.c: Refer variable static_var_1 in fn_1. * gdb.base/shreloc2.c: Refer variable static_var_2 in fn_2. Index: gdb.base/shreloc.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/shreloc.exp,v retrieving revision 1.2 diff -c -3 -p -r1.2 shreloc.exp *** gdb.base/shreloc.exp 11 Nov 2003 17:58:28 -0000 1.2 --- gdb.base/shreloc.exp 1 May 2005 02:04:17 -0000 *************** *** 1,4 **** ! # Copyright (C) 2003 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by --- 1,4 ---- ! # Copyright (C) 2003, 2005 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by *************** *** 15,23 **** # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # - # Please email any bugs, comments, and/or additions to this file to: - # bug-gdb@prep.ai.mit.edu - # Tests for shared object file relocation. If two shared objects have # the same load address (actually, overlapping load spaces), one of # them gets relocated at load-time. Check that gdb gets the right --- 15,20 ---- *************** set prms_id 0 *** 40,71 **** set bug_id 0 set workdir ${objdir}/${subdir} ! foreach module [list "shreloc" "shreloc1" "shreloc2"] { ! if {[gdb_compile "${srcdir}/${subdir}/${module}.c" "${workdir}/${module}.o" object {debug}] != ""} { ! untested "Couldn't compile ${module}.c" ! return -1 ! } } ! set additional_flags "additional_flags=-shared" if {([istarget "*pc-cygwin"] || [istarget "*pc-mingw32"]) } { ! set additional_flags "${additional_flags} -Wl,--image-base,0x04000000" } ! foreach module [list "shreloc1" "shreloc2"] { ! if {[gdb_compile "${workdir}/${module}.o" "${workdir}/${module}.dll" executable [list debug $additional_flags]] != ""} { ! untested "Couldn't link ${module}.dll" ! return -1 ! } } ! if {[gdb_compile [list "${workdir}/shreloc.o" "${workdir}/shreloc1.dll" "${workdir}/shreloc2.dll"] "${workdir}/shreloc" executable debug] != ""} { ! untested "Couldn't link shreloc executable" return -1 } gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir --- 37,86 ---- set bug_id 0 set workdir ${objdir}/${subdir} + set testfile "shreloc" + set libfile1 "shreloc1" + set libfile2 "shreloc2" + set srcfile $srcdir/$subdir/$testfile.c + set lib1src $srcdir/$subdir/$libfile1.c + set lib2src $srcdir/$subdir/$libfile2.c + set binfile $objdir/$subdir/$testfile + set lib1_sl $objdir/$subdir/$libfile1.sl + set lib2_sl $objdir/$subdir/$libfile2.sl ! if [get_compiler_info ${binfile}] { ! return -1 } ! set lib_opts "debug" ! set exec_opts [list debug shlib=$lib1_sl shlib=$lib2_sl] if {([istarget "*pc-cygwin"] || [istarget "*pc-mingw32"]) } { ! lappend lib_opts "additional_flags=-Wl,--image-base,0x04000000" } ! if [test_compiler_info "xlc-*"] { ! ! # IBM's xlc compiler does not add static variables to the ELF symbol ! # table by default. We need this option to make the variables show ! # up in "maint print msymbols". ! ! lappend lib_opts "additional_flags=-qstatsym" ! } ! if { [gdb_compile_shlib $lib1src $lib1_sl $lib_opts] != ""} { ! untested "Could not build $lib1_sl." ! return -1 ! } elseif { [gdb_compile_shlib $lib2src $lib2_sl $lib_opts] != ""} { ! untested "Could not build $lib1_s2." ! return -1 ! } elseif { [gdb_compile $srcfile $binfile executable $exec_opts] != ""} { ! untested "Could not build $binfile." return -1 } + # Start with a fresh gdb. + gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir Index: gdb.base/shreloc1.c =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/shreloc1.c,v retrieving revision 1.1 diff -c -3 -p -r1.1 shreloc1.c *** gdb.base/shreloc1.c 9 Jun 2003 21:23:53 -0000 1.1 --- gdb.base/shreloc1.c 1 May 2005 02:04:17 -0000 *************** *** 6,10 **** static int static_var_1; ! ATTRIBUTES void fn_1 (int unused) { } ATTRIBUTES int extern_var_1 = 0; --- 6,10 ---- static int static_var_1; ! ATTRIBUTES void fn_1 (int refered) { static_var_1 = refered; } ATTRIBUTES int extern_var_1 = 0; Index: gdb.base/shreloc2.c =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/shreloc2.c,v retrieving revision 1.1 diff -c -3 -p -r1.1 shreloc2.c *** gdb.base/shreloc2.c 9 Jun 2003 21:23:53 -0000 1.1 --- gdb.base/shreloc2.c 1 May 2005 02:04:17 -0000 *************** *** 6,10 **** static int static_var_2; ! ATTRIBUTES void fn_2 (int unused) { } ATTRIBUTES int extern_var_2 = 0; --- 6,10 ---- static int static_var_2; ! ATTRIBUTES void fn_2 (int refered) { static_var_2 = refered; } ATTRIBUTES int extern_var_2 = 0; ========================End of this patch================================ Cheers - Wu Zhou