public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  archer-jankratochvil-ifunc: Testcase made compatible.
@ 2010-03-21 21:46 jkratoch
  0 siblings, 0 replies; only message in thread
From: jkratoch @ 2010-03-21 21:46 UTC (permalink / raw)
  To: archer-commits

The branch, archer-jankratochvil-ifunc has been updated
       via  2255cf5050e51b9b2b1c09aa9ae0c1dd12e6fdd2 (commit)
      from  16ffb41b7fc53b336b8a5a616bc5a9b1dbcd342d (commit)

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

- Log -----------------------------------------------------------------
commit 2255cf5050e51b9b2b1c09aa9ae0c1dd12e6fdd2
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Sun Mar 21 22:44:04 2010 +0100

    Testcase made compatible.

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

Summary of changes:
 gdb/testsuite/gdb.base/gnu-ifunc-lib.c |   35 ++++--------------------------
 gdb/testsuite/gdb.base/gnu-ifunc.c     |   27 +++++++++++++++++++++++-
 gdb/testsuite/gdb.base/gnu-ifunc.exp   |   36 ++++++++------------------------
 3 files changed, 40 insertions(+), 58 deletions(-)

First 500 lines of diff:
diff --git a/gdb/testsuite/gdb.base/gnu-ifunc-lib.c b/gdb/testsuite/gdb.base/gnu-ifunc-lib.c
index 86d664c..680530a 100644
--- a/gdb/testsuite/gdb.base/gnu-ifunc-lib.c
+++ b/gdb/testsuite/gdb.base/gnu-ifunc-lib.c
@@ -15,43 +15,18 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include <assert.h>
+extern volatile int gnu_ifunc_initialized;
+extern int init_stub (int arg);
+extern int final (int arg);
 
 typedef int (*final_t) (int arg);
 
-static int
-init_stub (int arg)
-{
-  return 0;
-}
-
-static int
-final (int arg)
-{
-  return arg + 1;
-}
-
-/* Make differentiation of how the gnu_ifunc call resolves before and after
-   calling gnu_ifunc_pre.  This ensures the resolved function address is not
-   being cached anywhere for the debugging purposes.  */
-
-static volatile int gnu_ifunc_initialized;
-
-void
-gnu_ifunc_pre (void)
-{
-  assert (!gnu_ifunc_initialized);
-
-  gnu_ifunc_initialized = 1;
-}
-
-final_t gnu_ifuncX (void) asm ("gnu_ifunc");
 asm (".type gnu_ifunc, @gnu_indirect_function");
 
 final_t
-gnu_ifuncX (void)
+gnu_ifunc (void)
 {
-  if (!gnu_ifunc_initialized)
+  if (! gnu_ifunc_initialized)
     return init_stub;
   else
     return final;
diff --git a/gdb/testsuite/gdb.base/gnu-ifunc.c b/gdb/testsuite/gdb.base/gnu-ifunc.c
index fe30e18..106271f 100644
--- a/gdb/testsuite/gdb.base/gnu-ifunc.c
+++ b/gdb/testsuite/gdb.base/gnu-ifunc.c
@@ -17,8 +17,33 @@
 
 #include <assert.h>
 
+int
+init_stub (int arg)
+{
+  return 0;
+}
+
+int
+final (int arg)
+{
+  return arg + 1;
+}
+
+/* Make differentiation of how the gnu_ifunc call resolves before and after
+   calling gnu_ifunc_pre.  This ensures the resolved function address is not
+   being cached anywhere for the debugging purposes.  */
+
+volatile int gnu_ifunc_initialized;
+
+static void
+gnu_ifunc_pre (void)
+{
+  assert (!gnu_ifunc_initialized);
+
+  gnu_ifunc_initialized = 1;
+}
+
 extern int gnu_ifunc (int arg);
-extern void gnu_ifunc_pre (void);
 
 int
 main (void)
diff --git a/gdb/testsuite/gdb.base/gnu-ifunc.exp b/gdb/testsuite/gdb.base/gnu-ifunc.exp
index 7a658a5..edb0cbd 100644
--- a/gdb/testsuite/gdb.base/gnu-ifunc.exp
+++ b/gdb/testsuite/gdb.base/gnu-ifunc.exp
@@ -25,9 +25,6 @@ set libfile "${testfile}-lib"
 set libsrc ${libfile}.c
 set lib_so ${objdir}/${subdir}/${libfile}.so
 
-set lib_nodebug_so_base ${libfile}-nodebug.so
-set lib_nodebug_so ${objdir}/${subdir}/${lib_nodebug_so_base}
-
 # We need DWARF for the "final" function as we "step" into the function and GDB
 # would step-over the "final" function if there would be no line number debug
 # information (DWARF) available.
@@ -36,22 +33,13 @@ set lib_nodebug_so ${objdir}/${subdir}/${lib_nodebug_so_base}
 # express the gnu-ifunc type and it would be considered as a regular function
 # due to DWARF by GDB.  In ELF gnu-ifunc is expressed by the STT_GNU_IFUNC type.
 #
-# As both functions need to be in the same shared library file and
-# gdb_compile_shlib has no way to specify source-specific compilation options
-# we hide the DWARF debug information for "gnu_ifunc" by defining it as
-# C "gnu_ifuncX" function with asm alias "gnu_ifunc".
-#
-# Still as "gnu_ifunc" gets the wrong "gnu_ifuncX" DWARF debug information it
-# confuses the ELF symbol address->symbol resoluted for printing the symbol
-# value.  Therefore use lib_nodebug_opts later to check the address->symbol
-# resolution without DWARF present there.
+# Both functions need to be in the same shared library file but
+# gdb_compile_shlib has no way to specify source-specific compilation options.
 #
-# Additionally GCC would generate incorrect DW_AT_MIPS_linkage_name <*gnu_ifunc>
-# for the "gnu_ifunc" DWARF symbol, therefore with disabled DWARF it is no
-# longer a problem.
+# Therefore $libfile contains only the gnu-ifunc function with no DWARF
+# referencing all the other parts from the main executable with DWARF.
 
-set lib_opts [list debug]
-set lib_nodebug_opts [list]
+set lib_opts {}
 set exec_opts [list debug shlib=$lib_so]
 
 if [get_compiler_info ${binfile}] {
@@ -59,8 +47,7 @@ if [get_compiler_info ${binfile}] {
 }
 
 if { [gdb_compile_shlib ${srcdir}/${subdir}/$libsrc $lib_so $lib_opts] != ""
-     || [gdb_compile ${srcdir}/${subdir}/$srcfile $binfile executable $exec_opts] != ""
-     || [gdb_compile_shlib ${srcdir}/${subdir}/$libsrc $lib_nodebug_so $lib_nodebug_opts] != ""} {
+     || [gdb_compile ${srcdir}/${subdir}/$srcfile $binfile executable $exec_opts] != ""} {
     untested "Could not compile either $libsrc or $srcfile."
     return -1
 }
@@ -112,8 +99,8 @@ gdb_test "frame" "#0 +(0x\[0-9a-f\]+ in +)?final \\(.*" "nextcall gnu_ifunc skip
 # gnu_ifunc resolver address without automatically getting from GDB the already
 # resolved function address.
 
-gdb_test "p gnu_ifunc" " = {<text variable, no debug info>} 0x\[0-9a-f\]+ <final>" "p gnu_ifunc executing"
-gdb_test "info sym gnu_ifunc" "final in section .*" "info sym gnu_ifunc executing"
+gdb_test "p gnu_ifunc" " = {<text gnu-indirect-function variable, no debug info>} 0x\[0-9a-f\]+ <gnu_ifunc>" "p gnu_ifunc executing"
+gdb_test "info sym gnu_ifunc" "gnu_ifunc in section .*" "info sym gnu_ifunc executing"
 
 set test "info addr gnu_ifunc"
 gdb_test_multiple $test $test {
@@ -123,10 +110,5 @@ gdb_test_multiple $test $test {
 }
 gdb_test "info sym $expect_out(1,string)" "gnu_ifunc in section .*" "info sym <gnu_ifunc-address>"
 
-
-# Check the lib_nodebug_opts variant.
-
-clean_restart $lib_nodebug_so_base
-
-gdb_test "p gnu_ifunc" " = {<text gnu-ifunc variable, no debug info>} 0x\[0-9a-f\]+ <\.?gnu_ifunc>" "p gnu_ifunc not executing without debug"
+gdb_test "p gnu_ifunc" " = {<text gnu-indirect-function variable, no debug info>} 0x\[0-9a-f\]+ <\.?gnu_ifunc>" "p gnu_ifunc not executing without debug"
 gdb_test "info sym gnu_ifunc" "gnu_ifunc in section .*" "info sym gnu_ifunc not executing without debug"


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


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

only message in thread, other threads:[~2010-03-21 21:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-21 21:46 [SCM] archer-jankratochvil-ifunc: Testcase made compatible jkratoch

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