From bb5aefd4eadf6c6b7cce3b4dca214a5a73dfb6da Mon Sep 17 00:00:00 2001 From: "fergus.henderson" Date: Wed, 6 Apr 2011 14:11:00 +0000 Subject: Fix some issues that caused the gdb-related tests to fail: 1. Recent gcc versions want us to use -Wl,--build-id rather than --build-id. 2. We had missed one of the places where we need to be passing that flag in. 3. With recent gcc/gdb versions, "break main; run" will sometimes stop at the first statement inside of main rather than on the function declaration. So "break main; run; step" may end up inside the code to puts() rather than in the code for main(). My fix was to use "break main; run; next" instead. It is inderminate (varies based on whether you use "-O", for example) whether we end up at the call to puts() or after the call to puts(), but either way the call to puts() should be in the gdb output log. Reviewed by Craig Silverstein. git-svn-id: http://distcc.googlecode.com/svn/trunk@738 01de4be4-8c4a-0410-9132-4925637da917 --- test/testdistcc.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/test/testdistcc.py b/test/testdistcc.py index 26a65cf..86f2a6c 100755 --- a/test/testdistcc.py +++ b/test/testdistcc.py @@ -1246,7 +1246,8 @@ class Gdb_Case(CompileHello_Case): value set by the compilation. """ os.mkdir('link') - cmd = self.distcc() + self.compiler() + " -o link/testtmp obj/testtmp.o" + cmd = self.distcc() + self.compiler() + self.build_id + + " -o link/testtmp obj/testtmp.o" out, err = self.runcmd(cmd) if out != '': self.fail("command %s produced output:\n%s" % (`cmd`, `out`)) @@ -1261,10 +1262,15 @@ class Gdb_Case(CompileHello_Case): # Test if the compiler supports --build-id=0xNNN. # If so, we need to use it for this test. + # If not, try the alternative syntax -Wl,--build-id=0xNNN instead. self.build_id = " --build-id=0x12345678 " error_rc, _, _ = self.runcmd_unchecked(self.compiler() + - (self.build_id + " -o junk %s" % self.sourceFilename())) + (self.build_id + " -o junk -I. %s" % self.sourceFilename())) if error_rc != 0: + self.build_id = " -Wl,--build-id=0x12345678 " + error_rc, _, _ = self.runcmd_unchecked(self.compiler() + + (self.build_id + " -o junk -I. %s" % self.sourceFilename())) + if error_rc != 0: self.build_id = "" CompileHello_Case.runtest (self) @@ -1282,7 +1288,7 @@ class Gdb_Case(CompileHello_Case): # the gdb commands directly on the commandline using gdb --ex, # is not as portable since only newer gdb's support it.) f = open('gdb_commands', 'w') - f.write('break main\nrun\nstep\n') + f.write('break main\nrun\nnext\n') f.close() out, errs = self.runcmd("gdb --batch --command=gdb_commands " "link/%s