* [RFA] py-value.exp: Use different names for C/C++ .o files.
@ 2013-08-01 21:10 Doug Evans
2013-08-07 15:15 ` Jan Kratochvil
2013-08-07 19:11 ` Jan Kratochvil
0 siblings, 2 replies; 5+ messages in thread
From: Doug Evans @ 2013-08-01 21:10 UTC (permalink / raw)
To: gdb-patches, jan.kratochvil
Hi.
Awhile ago I submitted this patch:
http://sourceware.org/ml/gdb-patches/2012-05/msg00553.html
Jan requested I do things differently:
http://sourceware.org/ml/gdb-patches/2012-05/msg00568.html
This patch implements this request for py-value.exp.
Namely different .o files are used for C and C++ so that the
C++ compilation doesn't clobber the .dwo file of the C compilation.
Also, I noticed that the C++ test wasn't checking skip_cplus_tests.
Adding that made the code more like my original patch, but this
new patch still makes it easier to reproduce results by hand.
While I was at it I renamed py-value.cc which is used by py-value-cc.exp.
It's confusing to have py-value.cc *not* used by py-value.exp.
Regression tested on amd64-linux, with/without Fission.
Ok to check in?
2013-08-01 Doug Evans <dje@google.com>
* gdb.python/py-value-cc.cc: Renamed from py-value.cc.
* gdb.python/py-value-cc.exp: Update.
* gdb.python/py-value.exp: Use different names for .o files for
C and C++. Only perform C++ tests if !skip_cplus_tests.
Index: testsuite/gdb.python/py-value-cc.cc
===================================================================
RCS file: testsuite/gdb.python/py-value-cc.cc
diff -N testsuite/gdb.python/py-value-cc.cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ testsuite/gdb.python/py-value-cc.cc 1 Aug 2013 20:57:32 -0000
@@ -0,0 +1,39 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2012-2013 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
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+class A {
+};
+
+typedef int *int_ptr;
+
+int
+func (const A &a)
+{
+ int val = 10;
+ int &int_ref = val;
+ int_ptr ptr = &val;
+ int_ptr &int_ptr_ref = ptr;
+
+ return 0; /* Break here. */
+}
+
+int
+main ()
+{
+ A obj;
+ return func (obj);
+}
Index: testsuite/gdb.python/py-value-cc.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.python/py-value-cc.exp,v
retrieving revision 1.4
diff -u -p -r1.4 py-value-cc.exp
--- testsuite/gdb.python/py-value-cc.exp 1 Jan 2013 06:41:26 -0000 1.4
+++ testsuite/gdb.python/py-value-cc.exp 1 Aug 2013 20:57:32 -0000
@@ -18,7 +18,7 @@
if { [skip_cplus_tests] } { continue }
-standard_testfile py-value.cc
+standard_testfile .cc
if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} {
return -1
Index: testsuite/gdb.python/py-value.cc
===================================================================
RCS file: testsuite/gdb.python/py-value.cc
diff -N testsuite/gdb.python/py-value.cc
--- testsuite/gdb.python/py-value.cc 1 Jan 2013 06:41:26 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,39 +0,0 @@
-/* This testcase is part of GDB, the GNU debugger.
-
- Copyright 2012-2013 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
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-class A {
-};
-
-typedef int *int_ptr;
-
-int
-func (const A &a)
-{
- int val = 10;
- int &int_ref = val;
- int_ptr ptr = &val;
- int_ptr &int_ptr_ref = ptr;
-
- return 0; /* Break here. */
-}
-
-int
-main ()
-{
- A obj;
- return func (obj);
-}
Index: testsuite/gdb.python/py-value.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.python/py-value.exp,v
retrieving revision 1.33
diff -u -p -r1.33 py-value.exp
--- testsuite/gdb.python/py-value.exp 1 Jan 2013 06:41:26 -0000 1.33
+++ testsuite/gdb.python/py-value.exp 1 Aug 2013 20:57:32 -0000
@@ -21,13 +21,26 @@ load_lib gdb-python.exp
standard_testfile
# Build inferior to language specification.
+# LANG is one of "c" or "c++".
proc build_inferior {exefile lang} {
global srcdir subdir srcfile testfile hex
- if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${exefile}" executable "debug $lang"] != "" } {
+ # Use different names for .o files based on the language.
+ # For Fission, the debug info goes in foo.dwo and we don't want,
+ # for example, a C++ compile to clobber the dwo of a C compile.
+ # ref: http://gcc.gnu.org/wiki/DebugFission
+ switch ${lang} {
+ "c" { set filename ${testfile}.o }
+ "c++" { set filename ${testfile}-cxx.o }
+ }
+ set objfile [standard_output_file $filename]
+
+ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object "debug $lang"] != ""
+ || [gdb_compile "${objfile}" "${exefile}" executable "debug $lang"] != "" } {
untested "Couldn't compile ${srcfile} in $lang mode"
return -1
}
+ return 0
}
proc test_value_creation {} {
@@ -463,9 +476,10 @@ proc test_value_hash {} {
gdb_test "python print (one.__hash__() == hash(one))" "True" "Test inbuilt hash"
}
-# Build C and C++ versions of executable
-build_inferior "${binfile}" "c"
-build_inferior "${binfile}-cxx" "c++"
+# Build C version of executable. C++ is built later.
+if { [build_inferior "${binfile}" "c"] < 0 } {
+ return -1
+}
# Start with a fresh gdb.
clean_restart ${binfile}
@@ -494,5 +508,12 @@ test_lazy_strings
test_value_after_death
# Test either C or C++ values.
+
test_subscript_regression "${binfile}" "c"
-test_subscript_regression "${binfile}-cxx" "c++"
+
+if ![skip_cplus_tests] {
+ if { [build_inferior "${binfile}-cxx" "c++"] < 0 } {
+ return -1
+ }
+ test_subscript_regression "${binfile}-cxx" "c++"
+}
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFA] py-value.exp: Use different names for C/C++ .o files.
2013-08-01 21:10 [RFA] py-value.exp: Use different names for C/C++ .o files Doug Evans
@ 2013-08-07 15:15 ` Jan Kratochvil
2013-08-07 16:49 ` Cary Coutant
2013-08-07 19:11 ` Jan Kratochvil
1 sibling, 1 reply; 5+ messages in thread
From: Jan Kratochvil @ 2013-08-07 15:15 UTC (permalink / raw)
To: Doug Evans; +Cc: gdb-patches
On Thu, 01 Aug 2013 23:10:10 +0200, Doug Evans wrote:
> While I was at it I renamed py-value.cc which is used by py-value-cc.exp.
> It's confusing to have py-value.cc *not* used by py-value.exp.
This is BTW an unrelated part of the patch (I do not mind).
> Regression tested on amd64-linux, with/without Fission.
I wanted to look at the Fission behavior but I cannot Google out where to find
/usr/bin/dwp . Could you reference in contrib/cc-with-tweaks.sh and/or DWP
Wiki where to get the dwp tool?
Thanks,
Jan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFA] py-value.exp: Use different names for C/C++ .o files.
2013-08-07 15:15 ` Jan Kratochvil
@ 2013-08-07 16:49 ` Cary Coutant
2013-08-07 17:12 ` Cary Coutant
0 siblings, 1 reply; 5+ messages in thread
From: Cary Coutant @ 2013-08-07 16:49 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: Doug Evans, gdb-patches
> I wanted to look at the Fission behavior but I cannot Google out where to find
> /usr/bin/dwp . Could you reference in contrib/cc-with-tweaks.sh and/or DWP
> Wiki where to get the dwp tool?
It's built alongside the gold linker. I've added info about where to
find it and how to invoke it to the DebugFissionDWP wiki page. (Sorry,
I should have done that sooner.)
At the moment, the dwp utility generates the new v2 dwp file format,
which isn't yet supported by GDB. I shouldn't have committed that
change until GDB was prepared to support it, so I'll revert that patch
shortly, and you'll be able to build a dwp that supports the v1 format
that GDB does currently support. The top-of-trunk readelf can dump
both v1 and v2 formats.
-cary
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFA] py-value.exp: Use different names for C/C++ .o files.
2013-08-07 16:49 ` Cary Coutant
@ 2013-08-07 17:12 ` Cary Coutant
0 siblings, 0 replies; 5+ messages in thread
From: Cary Coutant @ 2013-08-07 17:12 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: Doug Evans, gdb-patches
> At the moment, the dwp utility generates the new v2 dwp file format,
> which isn't yet supported by GDB. I shouldn't have committed that
> change until GDB was prepared to support it, so I'll revert that patch
> shortly, and you'll be able to build a dwp that supports the v1 format
> that GDB does currently support. The top-of-trunk readelf can dump
> both v1 and v2 formats.
OK, I've committed a patch to revert the v2 support in dwp. I'll
restore it when GDB support is there.
-cary
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFA] py-value.exp: Use different names for C/C++ .o files.
2013-08-01 21:10 [RFA] py-value.exp: Use different names for C/C++ .o files Doug Evans
2013-08-07 15:15 ` Jan Kratochvil
@ 2013-08-07 19:11 ` Jan Kratochvil
1 sibling, 0 replies; 5+ messages in thread
From: Jan Kratochvil @ 2013-08-07 19:11 UTC (permalink / raw)
To: Doug Evans; +Cc: gdb-patches
On Thu, 01 Aug 2013 23:10:10 +0200, Doug Evans wrote:
> Awhile ago I submitted this patch:
>
> http://sourceware.org/ml/gdb-patches/2012-05/msg00553.html
>
> Jan requested I do things differently:
>
> http://sourceware.org/ml/gdb-patches/2012-05/msg00568.html
[...]
> * gdb.python/py-value-cc.cc: Renamed from py-value.cc.
> * gdb.python/py-value-cc.exp: Update.
> * gdb.python/py-value.exp: Use different names for .o files for
> C and C++. Only perform C++ tests if !skip_cplus_tests.
I am fine with your patch:
runtest CC_FOR_TARGET=gcc\ -gsplit-dwarf CXX_FOR_TARGET=g++\ -gsplit-dwarf gdb.python/py-value.exp
->
py-value-cxx
py-value-cxx.o
py-value-cxx.dwo
py-value
py-value.o
py-value.dwo
DWP=.../binutils/gold/dwp runtest CC_FOR_TARGET=/bin/sh\ $PWD/../contrib/cc-with-tweaks.sh\ -p\ gcc\ -gsplit-dwarf CXX_FOR_TARGET=/bin/sh\ $PWD/../contrib/cc-with-tweaks.sh\ -p\ g++\ -gsplit-dwarf gdb.python/py-value.exp
->
py-value-cxx.dwp
py-value-cxx
py-value-cxx.o
py-value.dwp
py-value
py-value.o
Thanks,
Jan
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-08-07 19:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-01 21:10 [RFA] py-value.exp: Use different names for C/C++ .o files Doug Evans
2013-08-07 15:15 ` Jan Kratochvil
2013-08-07 16:49 ` Cary Coutant
2013-08-07 17:12 ` Cary Coutant
2013-08-07 19:11 ` Jan Kratochvil
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).