Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Wu Zhou <woodzltc@cn.ibm.com>
To: Daniel Jacobowitz <drow@false.org>
Cc: pgilliam@us.ibm.com, gdb-patches@sources.redhat.com
Subject: Re: [patch] update gdb.base/shreloc.exp to use new shared library infrastructure
Date: Mon, 09 May 2005 06:28:00 -0000	[thread overview]
Message-ID: <1115618901.427efe5535a1f@imap.linux.ibm.com> (raw)

[-- 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; 

             reply	other threads:[~2005-05-09  6:08 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-09  6:28 Wu Zhou [this message]
  -- 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1115618901.427efe5535a1f@imap.linux.ibm.com \
    --to=woodzltc@cn.ibm.com \
    --cc=drow@false.org \
    --cc=gdb-patches@sources.redhat.com \
    --cc=pgilliam@us.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox