* Re: [patch] update gdb.base/shreloc.exp to use new shared library infrastructure
@ 2005-05-09 6:28 Wu Zhou
0 siblings, 0 replies; 19+ messages in thread
From: Wu Zhou @ 2005-05-09 6:28 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: pgilliam, gdb-patches
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: multipart/mixed; boundary="-MOQ1115618901005618700ae1a9c93cf03886e26bb139", Size: 32 bytes --]
This message is in MIME format.
[-- Attachment #2: Type: text/plain, Size: 6784 bytes --]
Hi Daniel,
Did you had a chance to review this revised patch? I am now using LTC's
web mail client, which should not do any mangle on the mail. If it still
made trouble to read, please see the attached file for the patch.
Thanks.
- Wu Zhou
Quoting Wu Zhou <woodzltc@cn.ibm.com>:
> > > 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 <pgilliam@us.ibm.com>
> Wu Zhou <woodzltc@cn.ibm.com>
>
> * 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
>
>
Cheers
- Wu Zhou
[-- Attachment #3: base_shreloc.patch --]
[-- Type: text/plain, Size: 5483 bytes --]
2005-05-01 Paul Gilliam <pgilliam@us.ibm.com>
Wu Zhou <woodzltc@cn.ibm.com>
* 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;
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [patch] update gdb.base/shreloc.exp to use new shared library infrastructure
@ 2005-05-18 3:20 Wu Zhou
0 siblings, 0 replies; 19+ messages in thread
From: Wu Zhou @ 2005-05-18 3:20 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: gdb-patches
Quoting Daniel Jacobowitz <drow@false.org>:
> On Tue, May 17, 2005 at 10:38:46AM -0400, Wu Zhou wrote:
> > No. I don't have write access yet. As you might know, I am very new to
> > GDB development. Maybe I need some good patches to get the write access.
> > So maybe someone else need to commit this(I can rewrite the changelog).
> > I could ask Paul to do this. But if you are willing to do it, that will
> > be highly appreciated.
>
> I've checked in the patch. Your mailer is still mangling tabs, even in
> attachments; the patch did not apply cleanly because several had been
> converted to spaces.
Thanks for your kind help. It is a great pity that the mailer still mangle
tabs. Really sorry for the trouble it brought. I will have someone look
into this for me immediately.
- Wu Zhou
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [patch] update gdb.base/shreloc.exp to use new shared library infrastructure
@ 2005-05-17 15:15 Wu Zhou
2005-05-18 1:50 ` Daniel Jacobowitz
0 siblings, 1 reply; 19+ messages in thread
From: Wu Zhou @ 2005-05-17 15:15 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: pgilliam, gdb-patches
Quoting Daniel Jacobowitz <drow@false.org>:
> On Tue, May 17, 2005 at 06:20:02AM -0400, Wu Zhou wrote:
> > Hi Daniel,
> >
> > Thanks for pointing out these errors for me. Followed is the re-worked
> > patch.
> >
> > 2005-05-17 Paul Gilliam <pgilliam@us.ibm.com>
> > Wu Zhou <woodzltc@cn.ibm.com>
> >
> > * gdb.base/shreloc.exp: Use gdb_compile_shlib. Add support for
> > IBM's xlc compiler.
> > * gdb.base/shreloc1.c (fn_1): Reference variable static_var_1.
> > * gdb.base/shreloc2.c (fn_2): Reference variable static_var_2.
>
> This is fine to commit; do you have write access?
>
> Make sure to use tabs at the beginning of lines in the ChangeLog, and
> to put two spaces between your name and email address.
No. I don't have write access yet. As you might know, I am very new to
GDB development. Maybe I need some good patches to get the write access.
So maybe someone else need to commit this(I can rewrite the changelog).
I could ask Paul to do this. But if you are willing to do it, that will
be highly appreciated.
BTW. thanks for reminding me of the wording rules. And also for your kind
helps all the way. I learned a lot from working with you on this first
patch, which is also my first experience for contributing code to GNU
projects. With your and others' kind help, I believe I can do much better
next time. Thanks once again.
===============The re-worked changelog=================================
2005-05-17 Paul Gilliam <pgilliam@us.ibm.com>
Wu Zhou <woodzltc@cn.ibm.com>
* gdb.base/shreloc.exp: Use gdb_compile_shlib. Add support for
IBM's xlc compiler.
* gdb.base/shreloc1.c (fn_1): Reference variable static_var_1.
* gdb.base/shreloc2.c (fn_2): Reference variable static_var_2.
Cheers
- Wu Zhou
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [patch] update gdb.base/shreloc.exp to use new shared library infrastructure
2005-05-17 15:15 Wu Zhou
@ 2005-05-18 1:50 ` Daniel Jacobowitz
0 siblings, 0 replies; 19+ messages in thread
From: Daniel Jacobowitz @ 2005-05-18 1:50 UTC (permalink / raw)
To: gdb-patches
On Tue, May 17, 2005 at 10:38:46AM -0400, Wu Zhou wrote:
> No. I don't have write access yet. As you might know, I am very new to
> GDB development. Maybe I need some good patches to get the write access.
> So maybe someone else need to commit this(I can rewrite the changelog).
> I could ask Paul to do this. But if you are willing to do it, that will
> be highly appreciated.
I've checked in the patch. Your mailer is still mangling tabs, even in
attachments; the patch did not apply cleanly because several had been
converted to spaces.
Thanks for seeing it through.
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [patch] update gdb.base/shreloc.exp to use new shared library infrastructure
@ 2005-05-17 13:32 Wu Zhou
2005-05-17 14:11 ` Daniel Jacobowitz
0 siblings, 1 reply; 19+ messages in thread
From: Wu Zhou @ 2005-05-17 13:32 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: pgilliam, gdb-patches
[-- Attachment #1: Type: text/plain, Size: 6655 bytes --]
Quoting Daniel Jacobowitz <drow@false.org>:
> > Here goes the revised patch. Wishing that it will not get mangled any
> > more. Please review and comments.
> >
> > 2005-05-01 Paul Gilliam <pgilliam@us.ibm.com>
> > Wu Zhou <woodzltc@cn.ibm.com>
> >
> > * 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.
>
> Sorry about the delay. This patch is OK, but please change two things
> for me before you commit it: the correct term here is "reference"
> rather than "refer", and the ChangeLog entry should show where the
> changes take place. Like so:
>
> * gdb.base/shreloc.exp: Use gdb_compile_shlib. Add support for
> IBM's xlc compiler.
> * gdb.base/shreloc1.c (fn_1): Reference variable static_var_1.
> * gdb.base/shreloc2.c (fn_2): Reference variable static_var_2.
>
> So with that changelog, and "refered" changed to "referenced" in the
> patch, it is OK to commit.
>
Hi Daniel,
Thanks for pointing out these errors for me. Followed is the re-worked
patch.
2005-05-17 Paul Gilliam <pgilliam@us.ibm.com>
Wu Zhou <woodzltc@cn.ibm.com>
* gdb.base/shreloc.exp: Use gdb_compile_shlib. Add support for
IBM's xlc compiler.
* gdb.base/shreloc1.c (fn_1): Reference variable static_var_1.
* gdb.base/shreloc2.c (fn_2): Reference variable static_var_2.
Index: gdb.base/shreloc.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/shreloc.exp,v
retrieving revision 1.2
diff -c -p -r1.2 shreloc.exp
*** gdb.base/shreloc.exp 11 Nov 2003 17:58:28 -0000 1.2
--- gdb.base/shreloc.exp 17 May 2005 10:01:35 -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 -p -r1.1 shreloc1.c
*** gdb.base/shreloc1.c 9 Jun 2003 21:23:53 -0000 1.1
--- gdb.base/shreloc1.c 17 May 2005 10:01:35 -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 referenced) { static_var_1 = referenced; }
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 -p -r1.1 shreloc2.c
*** gdb.base/shreloc2.c 9 Jun 2003 21:23:53 -0000 1.1
--- gdb.base/shreloc2.c 17 May 2005 10:01:35 -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 referenced) { static_var_2 = referenced; }
ATTRIBUTES int extern_var_2 = 0;
===========================End of the patch=========================
Cheers
- Wu Zhou
[-- Attachment #2: shreloc_v3.patch --]
[-- Type: application/octet-stream, Size: 5004 bytes --]
Index: gdb.base/shreloc.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/shreloc.exp,v
retrieving revision 1.2
diff -c -p -r1.2 shreloc.exp
*** gdb.base/shreloc.exp 11 Nov 2003 17:58:28 -0000 1.2
--- gdb.base/shreloc.exp 17 May 2005 10:01:35 -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 -p -r1.1 shreloc1.c
*** gdb.base/shreloc1.c 9 Jun 2003 21:23:53 -0000 1.1
--- gdb.base/shreloc1.c 17 May 2005 10:01:35 -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 referenced) { static_var_1 = referenced; }
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 -p -r1.1 shreloc2.c
*** gdb.base/shreloc2.c 9 Jun 2003 21:23:53 -0000 1.1
--- gdb.base/shreloc2.c 17 May 2005 10:01:35 -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 referenced) { static_var_2 = referenced; }
ATTRIBUTES int extern_var_2 = 0;
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [patch] update gdb.base/shreloc.exp to use new shared library infrastructure
2005-05-17 13:32 Wu Zhou
@ 2005-05-17 14:11 ` Daniel Jacobowitz
0 siblings, 0 replies; 19+ messages in thread
From: Daniel Jacobowitz @ 2005-05-17 14:11 UTC (permalink / raw)
To: Wu Zhou; +Cc: pgilliam, gdb-patches
On Tue, May 17, 2005 at 06:20:02AM -0400, Wu Zhou wrote:
> Hi Daniel,
>
> Thanks for pointing out these errors for me. Followed is the re-worked
> patch.
>
> 2005-05-17 Paul Gilliam <pgilliam@us.ibm.com>
> Wu Zhou <woodzltc@cn.ibm.com>
>
> * gdb.base/shreloc.exp: Use gdb_compile_shlib. Add support for
> IBM's xlc compiler.
> * gdb.base/shreloc1.c (fn_1): Reference variable static_var_1.
> * gdb.base/shreloc2.c (fn_2): Reference variable static_var_2.
This is fine to commit; do you have write access?
Make sure to use tabs at the beginning of lines in the ChangeLog, and
to put two spaces between your name and email address.
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [patch] update gdb.base/shreloc.exp to use new shared library infrastructure
@ 2005-05-01 4:45 Wu Zhou
0 siblings, 0 replies; 19+ messages in thread
From: Wu Zhou @ 2005-05-01 4:45 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: pgilliam, gdb-patches
Quoting Daniel Jacobowitz <drow@false.org>:
> On Sun, May 01, 2005 at 12:18:44AM -0400, Wu Zhou wrote:
> > 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.
>
> Certainly. Is that enough to consider them referenced for xlc?
Yes. That is enough for xlc. I had re-worked out a patch and had a test against
xlc and gcc. Both worked. I had also sent out the patch. That is before I receive
the above mail. My mail server seems to be somewhat slow today. :-)
Cheers
- Wu Zhou
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [patch] update gdb.base/shreloc.exp to use new shared library infrastructure
@ 2005-05-01 4:36 Wu Zhou
2005-05-15 19:44 ` Daniel Jacobowitz
0 siblings, 1 reply; 19+ messages in thread
From: Wu Zhou @ 2005-05-01 4:36 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: pgilliam, gdb-patches
> > 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 <pgilliam@us.ibm.com>
Wu Zhou <woodzltc@cn.ibm.com>
* 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
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [patch] update gdb.base/shreloc.exp to use new shared library infrastructure
2005-05-01 4:36 Wu Zhou
@ 2005-05-15 19:44 ` Daniel Jacobowitz
0 siblings, 0 replies; 19+ messages in thread
From: Daniel Jacobowitz @ 2005-05-15 19:44 UTC (permalink / raw)
To: Wu Zhou; +Cc: pgilliam, gdb-patches
On Sun, May 01, 2005 at 12:35:31AM -0400, Wu Zhou wrote:
> > > 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 <pgilliam@us.ibm.com>
> Wu Zhou <woodzltc@cn.ibm.com>
>
> * 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.
Sorry about the delay. This patch is OK, but please change two things
for me before you commit it: the correct term here is "reference"
rather than "refer", and the ChangeLog entry should show where the
changes take place. Like so:
* gdb.base/shreloc.exp: Use gdb_compile_shlib. Add support for
IBM's xlc compiler.
* gdb.base/shreloc1.c (fn_1): Reference variable static_var_1.
* gdb.base/shreloc2.c (fn_2): Reference variable static_var_2.
So with that changelog, and "refered" changed to "referenced" in the
patch, it is OK to commit.
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [patch] update gdb.base/shreloc.exp to use new shared library infrastructure
@ 2005-05-01 4:19 Wu Zhou
2005-05-01 4:28 ` Daniel Jacobowitz
0 siblings, 1 reply; 19+ messages in thread
From: Wu Zhou @ 2005-05-01 4:19 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: pgilliam, gdb-patches
Quoting Daniel Jacobowitz <drow@false.org>:
> This does not be long in the changelog, only in the comments. The
> ChangeLog for this patch should look like:
>
> 2005-04-29 Paul Gilliam <pgilliam@us.ibm.com>
> Wu Zhou <woodzltc@cn.ibm.com>
>
> * gdb.base/shreloc.exp: Use gdb_compile_shlib. Add support for
> IBM's xlc compiler.
>
> If you're going to post patches to this list, please find a mail client
> which does not mangle line wrapping; the patch as I received it is hard
> to read and can not be applied.
Sorry, wish that this time it is ok.
> OK, now I understand why you needed the options. We will need
> -qstatsym; here's a better description:
>
> # IBM's xlc compiler does not add static variables to the ELFe symbol
> # table by default. We need this option to make the variables show
> # up in "maint print msymbols".
>
> 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.
Cheers
- Wu Zhou
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [patch] update gdb.base/shreloc.exp to use new shared library infrastructure
2005-05-01 4:19 Wu Zhou
@ 2005-05-01 4:28 ` Daniel Jacobowitz
0 siblings, 0 replies; 19+ messages in thread
From: Daniel Jacobowitz @ 2005-05-01 4:28 UTC (permalink / raw)
To: Wu Zhou; +Cc: pgilliam, gdb-patches
On Sun, May 01, 2005 at 12:18:44AM -0400, Wu Zhou wrote:
> 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.
Certainly. Is that enough to consider them referenced for xlc?
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 19+ messages in thread
* [patch] update gdb.base/shreloc.exp to use new shared library infrastructure
@ 2005-04-13 17:14 Paul Gilliam
2005-04-14 19:23 ` Daniel Jacobowitz
0 siblings, 1 reply; 19+ messages in thread
From: Paul Gilliam @ 2005-04-13 17:14 UTC (permalink / raw)
To: gdb-patches
This patch updates gdb.base/shreloc.exp to use the new shared library infrastructure in
lib/gdb.exp. All the stuff that has been cut from shlib-call.exp is now part of 'gdb-compile'
or 'gdb-compile-shlib' (new) in lib/gdb.exp.
This patch depends on the shared infrastructure patch:
http://sources.redhat.com/ml/gdb-patches/2005-04/msg00096.html
-=# Paul #=-
2005-04-13 Paul Gilliam <pgilliam@us.ibm.com>
* gdb.base/shreloc.exp: Change to use new shared library infrastructure and update
copyright date.
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 13 Apr 2005 16:58:13 -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
*************** set prms_id 0
*** 40,70 ****
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
--- 40,73 ----
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
}
! if [test_compiler_info "xlc-*"] {
! set lib_opts [list debug additional_flags=-qstatsym additional_flags=-qdbxextra]
! } else {
! set lib_opts debug
}
+ set exec_opts [list debug shlib=$lib1_sl shlib=$lib2_sl]
! if {[gdb_compile_shlib $lib1src $lib1_sl $lib_opts] != ""
! || [gdb_compile_shlib $lib2src $lib2_sl $lib_opts] != ""
! || [gdb_compile $srcfile $binfile executable $exec_opts] != ""} {
! gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
! # Start with a fresh gdb.
gdb_exit
gdb_start
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [patch] update gdb.base/shreloc.exp to use new shared library infrastructure
2005-04-13 17:14 Paul Gilliam
@ 2005-04-14 19:23 ` Daniel Jacobowitz
2005-04-15 19:41 ` Paul Gilliam
2005-04-20 0:31 ` Paul Gilliam
0 siblings, 2 replies; 19+ messages in thread
From: Daniel Jacobowitz @ 2005-04-14 19:23 UTC (permalink / raw)
To: Paul Gilliam; +Cc: gdb-patches
On Wed, Apr 13, 2005 at 09:13:36AM -0800, Paul Gilliam wrote:
> This patch updates gdb.base/shreloc.exp to use the new shared library infrastructure in
> lib/gdb.exp. All the stuff that has been cut from shlib-call.exp is now part of 'gdb-compile'
> or 'gdb-compile-shlib' (new) in lib/gdb.exp.
>
> This patch depends on the shared infrastructure patch:
> http://sources.redhat.com/ml/gdb-patches/2005-04/msg00096.html
Waitasec...
> ! set additional_flags "additional_flags=-shared"
> !
> ! if {([istarget "*pc-cygwin"] || [istarget "*pc-mingw32"]) } {
> ! set additional_flags "${additional_flags} -Wl,--image-base,0x04000000"
> }
The common bits don't have support for cygwin/mingw32 DLLs. So just
removing this isn't right.
> ! set lib_opts [list debug additional_flags=-qstatsym additional_flags=-qdbxextra]
Remind me what this option means?
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [patch] update gdb.base/shreloc.exp to use new shared library infrastructure
2005-04-14 19:23 ` Daniel Jacobowitz
@ 2005-04-15 19:41 ` Paul Gilliam
2005-04-20 0:31 ` Paul Gilliam
1 sibling, 0 replies; 19+ messages in thread
From: Paul Gilliam @ 2005-04-15 19:41 UTC (permalink / raw)
To: gdb-patches; +Cc: Daniel Jacobowitz
On Thursday 14 April 2005 12:23, Daniel Jacobowitz wrote:
> On Wed, Apr 13, 2005 at 09:13:36AM -0800, Paul Gilliam wrote:
> > This patch updates gdb.base/shreloc.exp to use the new shared library infrastructure in
> > lib/gdb.exp. All the stuff that has been cut from shlib-call.exp is now part of 'gdb-compile'
> > or 'gdb-compile-shlib' (new) in lib/gdb.exp.
> >
> > This patch depends on the shared infrastructure patch:
> > http://sources.redhat.com/ml/gdb-patches/2005-04/msg00096.html
>
> Waitasec...
>
> > ! set additional_flags "additional_flags=-shared"
> > !
> > ! if {([istarget "*pc-cygwin"] || [istarget "*pc-mingw32"]) } {
> > ! set additional_flags "${additional_flags} -Wl,--image-base,0x04000000"
> > }
>
> The common bits don't have support for cygwin/mingw32 DLLs. So just
> removing this isn't right.
>
OK, sorry. I'll put it back in my next rev of the patch (comming soon)
>
> > ! set lib_opts [list debug additional_flags=-qstatsym additional_flags=-qdbxextra]
>
> Remind me what this option means?
>
>
IBM's xlc compiler doesn't add static variables to the symtab by default.
"-qstatsym" causes them to be added. 'xlc' will optimize un-used varialbe out
of the symtab, "-qdbxextra" disable this default behavior.
Maybe this should have been a seperate patch. Would that help?
-=# Paul #=-
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [patch] update gdb.base/shreloc.exp to use new shared library infrastructure
2005-04-14 19:23 ` Daniel Jacobowitz
2005-04-15 19:41 ` Paul Gilliam
@ 2005-04-20 0:31 ` Paul Gilliam
2005-04-27 15:58 ` Daniel Jacobowitz
1 sibling, 1 reply; 19+ messages in thread
From: Paul Gilliam @ 2005-04-20 0:31 UTC (permalink / raw)
To: gdb-patches; +Cc: Daniel Jacobowitz
On Thursday 14 April 2005 12:23, Daniel Jacobowitz wrote:
> On Wed, Apr 13, 2005 at 09:13:36AM -0800, Paul Gilliam wrote:
> > This patch updates gdb.base/shreloc.exp to use the new shared library infrastructure in
> > lib/gdb.exp. All the stuff that has been cut from shlib-call.exp is now part of 'gdb-compile'
> > or 'gdb-compile-shlib' (new) in lib/gdb.exp.
> >
> > This patch depends on the shared infrastructure patch:
> > http://sources.redhat.com/ml/gdb-patches/2005-04/msg00096.html
>
> Waitasec...
>
> > ! set additional_flags "additional_flags=-shared"
> > !
> > ! if {([istarget "*pc-cygwin"] || [istarget "*pc-mingw32"]) } {
> > ! set additional_flags "${additional_flags} -Wl,--image-base,0x04000000"
> > }
>
> The common bits don't have support for cygwin/mingw32 DLLs. So just
> removing this isn't right.
>
> > ! set lib_opts [list debug additional_flags=-qstatsym additional_flags=-qdbxextra]
>
> Remind me what this option means?
>
>
Here is the next rev of the patch:
2005-04-19 Paul Gilliam <pgilliam@us.ibm.com>
* gdb.base/shreloc.exp: Change to use new shared library infrastructure
and update copyright date.
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 19 Apr 2005 23:59:46 -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
*************** 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
--- 40,75 ----
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
}
! if [test_compiler_info "xlc-*"] {
! set lib_opts [list debug additional_flags=-qstatsym additional_flags=-qdbxextra]
! } else {
! set lib_opts debug
}
+ set exec_opts [list debug shlib=$lib1_sl shlib=$lib2_sl]
! if { [gdb_compile_shlib $lib1src $lib1_sl $lib_opts] != ""
! || [gdb_compile_shlib $lib2src $lib2_sl $lib_opts] != ""
! || [gdb_compile $srcfile $binfile executable $exec_opts] != ""} {
! untested "Could not compile $lib1src, $lib2src or $srcfile"
return -1
}
+ # Start with a fresh gdb.
+
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [patch] update gdb.base/shreloc.exp to use new shared library infrastructure
2005-04-20 0:31 ` Paul Gilliam
@ 2005-04-27 15:58 ` Daniel Jacobowitz
2005-04-29 23:15 ` Paul Gilliam
0 siblings, 1 reply; 19+ messages in thread
From: Daniel Jacobowitz @ 2005-04-27 15:58 UTC (permalink / raw)
To: Paul Gilliam; +Cc: gdb-patches
On Tue, Apr 19, 2005 at 04:31:06PM -0800, Paul Gilliam wrote:
> On Thursday 14 April 2005 12:23, Daniel Jacobowitz wrote:
> > On Wed, Apr 13, 2005 at 09:13:36AM -0800, Paul Gilliam wrote:
> > > This patch updates gdb.base/shreloc.exp to use the new shared library infrastructure in
> > > lib/gdb.exp. All the stuff that has been cut from shlib-call.exp is now part of 'gdb-compile'
> > > or 'gdb-compile-shlib' (new) in lib/gdb.exp.
> > >
> > > This patch depends on the shared infrastructure patch:
> > > http://sources.redhat.com/ml/gdb-patches/2005-04/msg00096.html
> >
> > Waitasec...
> >
> > > ! set additional_flags "additional_flags=-shared"
> > > !
> > > ! if {([istarget "*pc-cygwin"] || [istarget "*pc-mingw32"]) } {
> > > ! set additional_flags "${additional_flags} -Wl,--image-base,0x04000000"
> > > }
> >
> > The common bits don't have support for cygwin/mingw32 DLLs. So just
> > removing this isn't right.
> >
> > > ! set lib_opts [list debug additional_flags=-qstatsym additional_flags=-qdbxextra]
> >
> > Remind me what this option means?
> >
> >
> Here is the next rev of the patch:
>
> 2005-04-19 Paul Gilliam <pgilliam@us.ibm.com>
>
> * gdb.base/shreloc.exp: Change to use new shared library infrastructure
> and update copyright date.
The changelog doesn't mention the xlc changes; it should. The xlc
changes need comments explaining both what the options do, and (the bit
I haven't seen yet) why they are necessary for this test case. You
still removed the cygwin bits.
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [patch] update gdb.base/shreloc.exp to use new shared library infrastructure
2005-04-27 15:58 ` Daniel Jacobowitz
@ 2005-04-29 23:15 ` Paul Gilliam
2005-04-30 9:06 ` Wu Zhou
0 siblings, 1 reply; 19+ messages in thread
From: Paul Gilliam @ 2005-04-29 23:15 UTC (permalink / raw)
To: gdb-patches; +Cc: Wu Zhou, Daniel Jacobowitz
On Wednesday 27 April 2005 08:57, Daniel Jacobowitz wrote:
> On Tue, Apr 19, 2005 at 04:31:06PM -0800, Paul Gilliam wrote:
> > On Thursday 14 April 2005 12:23, Daniel Jacobowitz wrote:
> > > On Wed, Apr 13, 2005 at 09:13:36AM -0800, Paul Gilliam wrote:
> > > > This patch updates gdb.base/shreloc.exp to use the new shared library infrastructure in
> > > > lib/gdb.exp. All the stuff that has been cut from shlib-call.exp is now part of 'gdb-compile'
> > > > or 'gdb-compile-shlib' (new) in lib/gdb.exp.
> > > >
> > > > This patch depends on the shared infrastructure patch:
> > > > http://sources.redhat.com/ml/gdb-patches/2005-04/msg00096.html
> > >
> > > Waitasec...
> > >
> > > > ! set additional_flags "additional_flags=-shared"
> > > > !
> > > > ! if {([istarget "*pc-cygwin"] || [istarget "*pc-mingw32"]) } {
> > > > ! set additional_flags "${additional_flags} -Wl,--image-base,0x04000000"
> > > > }
> > >
> > > The common bits don't have support for cygwin/mingw32 DLLs. So just
> > > removing this isn't right.
> > >
> > > > ! set lib_opts [list debug additional_flags=-qstatsym additional_flags=-qdbxextra]
> > >
> > > Remind me what this option means?
> > >
> > >
> > Here is the next rev of the patch:
> >
> > 2005-04-19 Paul Gilliam <pgilliam@us.ibm.com>
> >
> > * gdb.base/shreloc.exp: Change to use new shared library infrastructure
> > and update copyright date.
>
> The changelog doesn't mention the xlc changes; it should. The xlc
> changes need comments explaining both what the options do, and (the bit
> I haven't seen yet) why they are necessary for this test case. You
> still removed the cygwin bits.
>
>
Here is the latest version of this patch. I think I got what you are asking for except for comments explaining why
the xlc options are necessary for this test case.
My team-mate, Wu Zhou (who now has his own copyright assignment on-file with the FSF) could shed some light on this.
-=# Paul #=-
2005-04-29 Paul Gilliam <pgilliam@us.ibm.com>
* gdb.base/shreloc.exp: Change to use new shared library
infrastructure and allow use of IBM's xlc compiler.
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 29 Apr 2005 22:55:44 -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,89 ----
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 doesn't add static variables to the symtab by default;
! # "-qstatsym" causes them to be added.
!
! lappend lib_opts "additional_flags=-qstatsym"
!
! # IBM's xlc compiler will optimize un-used varialbes out of the symtab.
! # "-qdbxextra" disable this default behavior.
!
! lappend lib_opts "additional_flags=-qdbxextra"
}
! 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
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [patch] update gdb.base/shreloc.exp to use new shared library infrastructure
2005-04-29 23:15 ` Paul Gilliam
@ 2005-04-30 9:06 ` Wu Zhou
2005-04-30 18:33 ` Daniel Jacobowitz
0 siblings, 1 reply; 19+ messages in thread
From: Wu Zhou @ 2005-04-30 9:06 UTC (permalink / raw)
To: pgilliam; +Cc: gdb-patches, Daniel Jacobowitz
Hi, Paul and Daniel
I made some little modification to the comments on the xlc-specific
options and also added a short text in changelog to explain why they are
necessary. I wish that I could make myself understood. But if there are
any errors or confusion, please feel free to let me know. Thanks.
Here goes the revised patch:
2005-04-29 Paul Gilliam <pgilliam@us.ibm.com>
Wu Zhou <woodzltc@cn.ibm.com>
* gdb.base/shreloc.exp: Change to use new shared library
infrastructure and allow use of IBM's xlc compiler.
* gdb.base/shreloc.exp: Add IBM's xlc specific option
"-qdbxextra" to
keep unused static variables(static_var_1 & static_var_2), and
option
"-qstatsym" to add them into msymtab
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 30 Apr 2005 02:55:15 -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,91 ----
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-*"] {
!
! # static variable static_var_1 & static_var_2 are not used
anywhere, IBM's
! # xlc compiler optimizes them out by default, "-qdbxextra" adds
them back
!
! lappend lib_opts "additional_flags=-qdbxextra"
!
! # IBM's xlc compiler doesn't add static variables to the symtab by
default,
! # so there is no static_var_1 & static_var_2 in the output of
"maint print
! # msymbols ${msymfile}", "-qstatsym" causes them to be added.
!
! 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
===================end of the patch=======================
Paul Gilliam wrote:
>On Wednesday 27 April 2005 08:57, Daniel Jacobowitz wrote:
>
>
>>On Tue, Apr 19, 2005 at 04:31:06PM -0800, Paul Gilliam wrote:
>>
>>
>>>On Thursday 14 April 2005 12:23, Daniel Jacobowitz wrote:
>>>
>>>
>>>>On Wed, Apr 13, 2005 at 09:13:36AM -0800, Paul Gilliam wrote:
>>>>
>>>>
>>>>>This patch updates gdb.base/shreloc.exp to use the new shared library infrastructure in
>>>>>lib/gdb.exp. All the stuff that has been cut from shlib-call.exp is now part of 'gdb-compile'
>>>>>or 'gdb-compile-shlib' (new) in lib/gdb.exp.
>>>>>
>>>>>This patch depends on the shared infrastructure patch:
>>>>> http://sources.redhat.com/ml/gdb-patches/2005-04/msg00096.html
>>>>>
>>>>>
>>>>Waitasec...
>>>>
>>>>
>>>>
>>>>>! set additional_flags "additional_flags=-shared"
>>>>>!
>>>>>! if {([istarget "*pc-cygwin"] || [istarget "*pc-mingw32"]) } {
>>>>>! set additional_flags "${additional_flags} -Wl,--image-base,0x04000000"
>>>>> }
>>>>>
>>>>>
>>>>The common bits don't have support for cygwin/mingw32 DLLs. So just
>>>>removing this isn't right.
>>>>
>>>>
>>>>
>>>>>! set lib_opts [list debug additional_flags=-qstatsym additional_flags=-qdbxextra]
>>>>>
>>>>>
>>>>Remind me what this option means?
>>>>
>>>>
>>>>
>>>>
>>>Here is the next rev of the patch:
>>>
>>>2005-04-19 Paul Gilliam <pgilliam@us.ibm.com>
>>>
>>> * gdb.base/shreloc.exp: Change to use new shared library infrastructure
>>> and update copyright date.
>>>
>>>
>>The changelog doesn't mention the xlc changes; it should. The xlc
>>changes need comments explaining both what the options do, and (the bit
>>I haven't seen yet) why they are necessary for this test case. You
>>still removed the cygwin bits.
>>
>>
>>
>>
>
>Here is the latest version of this patch. I think I got what you are asking for except for comments explaining why
>the xlc options are necessary for this test case.
>
>My team-mate, Wu Zhou (who now has his own copyright assignment on-file with the FSF) could shed some light on this.
>
>-=# Paul #=-
>
>2005-04-29 Paul Gilliam <pgilliam@us.ibm.com>
>
> * gdb.base/shreloc.exp: Change to use new shared library
> infrastructure and allow use of IBM's xlc compiler.
>
>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 29 Apr 2005 22:55:44 -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,89 ----
> 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 doesn't add static variables to the symtab by default;
>! # "-qstatsym" causes them to be added.
>!
>! lappend lib_opts "additional_flags=-qstatsym"
>!
>! # IBM's xlc compiler will optimize un-used varialbes out of the symtab.
>! # "-qdbxextra" disable this default behavior.
>!
>! lappend lib_opts "additional_flags=-qdbxextra"
> }
>
>! 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
>
>
>
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [patch] update gdb.base/shreloc.exp to use new shared library infrastructure
2005-04-30 9:06 ` Wu Zhou
@ 2005-04-30 18:33 ` Daniel Jacobowitz
0 siblings, 0 replies; 19+ messages in thread
From: Daniel Jacobowitz @ 2005-04-30 18:33 UTC (permalink / raw)
To: Wu Zhou; +Cc: pgilliam, gdb-patches
On Sat, Apr 30, 2005 at 05:06:06PM +0800, Wu Zhou wrote:
> Hi, Paul and Daniel
>
> I made some little modification to the comments on the xlc-specific
> options and also added a short text in changelog to explain why they are
> necessary. I wish that I could make myself understood. But if there are
> any errors or confusion, please feel free to let me know. Thanks.
This does not be long in the changelog, only in the comments. The
ChangeLog for this patch should look like:
2005-04-29 Paul Gilliam <pgilliam@us.ibm.com>
Wu Zhou <woodzltc@cn.ibm.com>
* gdb.base/shreloc.exp: Use gdb_compile_shlib. Add support for
IBM's xlc compiler.
If you're going to post patches to this list, please find a mail client
which does not mangle line wrapping; the patch as I received it is hard
to read and can not be applied.
> ! if [test_compiler_info "xlc-*"] {
> !
> ! # static variable static_var_1 & static_var_2 are not used
> anywhere, IBM's
> ! # xlc compiler optimizes them out by default, "-qdbxextra" adds
> them back
> !
> ! lappend lib_opts "additional_flags=-qdbxextra"
> !
> ! # IBM's xlc compiler doesn't add static variables to the symtab by
> default,
> ! # so there is no static_var_1 & static_var_2 in the output of
> "maint print
> ! # msymbols ${msymfile}", "-qstatsym" causes them to be added.
> !
> ! lappend lib_opts "additional_flags=-qstatsym"
> !
> }
OK, now I understand why you needed the options. We will need
-qstatsym; here's a better description:
# IBM's xlc compiler does not add static variables to the ELFe symbol
# table by default. We need this option to make the variables show
# up in "maint print msymbols".
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.
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2005-05-18 2:23 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-09 6:28 [patch] update gdb.base/shreloc.exp to use new shared library infrastructure Wu Zhou
-- strict thread matches above, loose matches on Subject: below --
2005-05-18 3:20 Wu Zhou
2005-05-17 15:15 Wu Zhou
2005-05-18 1:50 ` Daniel Jacobowitz
2005-05-17 13:32 Wu Zhou
2005-05-17 14:11 ` Daniel Jacobowitz
2005-05-01 4:45 Wu Zhou
2005-05-01 4:36 Wu Zhou
2005-05-15 19:44 ` Daniel Jacobowitz
2005-05-01 4:19 Wu Zhou
2005-05-01 4:28 ` Daniel Jacobowitz
2005-04-13 17:14 Paul Gilliam
2005-04-14 19:23 ` Daniel Jacobowitz
2005-04-15 19:41 ` Paul Gilliam
2005-04-20 0:31 ` Paul Gilliam
2005-04-27 15:58 ` Daniel Jacobowitz
2005-04-29 23:15 ` Paul Gilliam
2005-04-30 9:06 ` Wu Zhou
2005-04-30 18:33 ` Daniel Jacobowitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox