diff mbox

[5/9] gdb: Fix bug with dbx style func command.

Message ID 8629fd6198d107d87d4db9b3eec45774bfaae2b6.1441996064.git.andrew.burgess@embecosm.com
State New
Headers show

Commit Message

Andrew Burgess Sept. 11, 2015, 6:49 p.m. UTC
The func command, available when starting gdb in dbx mode, is supposed
to take a function name and locate the frame for that function in the
stack.  This has been broken for a while due to an invalid check of the
arguments within the worker function.  Fixed in this commit.

gdb/ChangeLog:

	* stack.c (func_command): Return early when there is no ARG
	string.

gdb/testsuite/ChangeLog:

	* gdb.base/dbx.exp (test_func): Remove xfails, update expected
	results.
---
 gdb/ChangeLog                  | 5 +++++
 gdb/stack.c                    | 2 +-
 gdb/testsuite/ChangeLog        | 5 +++++
 gdb/testsuite/gdb.base/dbx.exp | 6 +-----
 4 files changed, 12 insertions(+), 6 deletions(-)

Comments

Pedro Alves Sept. 30, 2015, 1:47 p.m. UTC | #1
On 09/11/2015 07:49 PM, Andrew Burgess wrote:
> The func command, available when starting gdb in dbx mode, is supposed
> to take a function name and locate the frame for that function in the
> stack.  This has been broken for a while due to an invalid check of the
> arguments within the worker function.  Fixed in this commit.

I wonder whether anyone uses / cares about the dbx mode...

> 
> gdb/ChangeLog:
> 
> 	* stack.c (func_command): Return early when there is no ARG
> 	string.
> 
> gdb/testsuite/ChangeLog:
> 
> 	* gdb.base/dbx.exp (test_func): Remove xfails, update expected
> 	results.

OK.

Thanks,
Pedro Alves
Thomas Preud'homme Oct. 26, 2015, 10:38 a.m. UTC | #2
> From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] On Behalf Of Pedro Alves
> Sent: Wednesday, September 30, 2015 9:47 PM
> 
> On 09/11/2015 07:49 PM, Andrew Burgess wrote:
> > The func command, available when starting gdb in dbx mode, is
> supposed
> > to take a function name and locate the frame for that function in the
> > stack.  This has been broken for a while due to an invalid check of the
> > arguments within the worker function.  Fixed in this commit.
> 
> I wonder whether anyone uses / cares about the dbx mode...
> 
> >
> > gdb/ChangeLog:
> >
> > 	* stack.c (func_command): Return early when there is no ARG
> > 	string.
> >
> > gdb/testsuite/ChangeLog:
> >
> > 	* gdb.base/dbx.exp (test_func): Remove xfails, update
> expected
> > 	results.
> 
> OK.

Actually dbx style func still fails on ARM so this changes shows up as a regression (XFAIL- > FAIL). See [1] for a bit more details.

[1] https://sourceware.org/bugzilla/show_bug.cgi?id=19127

Best regards,

Thomas
Andrew Burgess Oct. 26, 2015, 1:40 p.m. UTC | #3
* Thomas Preud'homme <thomas.preudhomme@arm.com> [2015-10-26 18:38:17 +0800]:

> > From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> > owner@sourceware.org] On Behalf Of Pedro Alves
> > Sent: Wednesday, September 30, 2015 9:47 PM
> > 
> > On 09/11/2015 07:49 PM, Andrew Burgess wrote:
> > > The func command, available when starting gdb in dbx mode, is
> > supposed
> > > to take a function name and locate the frame for that function in the
> > > stack.  This has been broken for a while due to an invalid check of the
> > > arguments within the worker function.  Fixed in this commit.
> > 
> > I wonder whether anyone uses / cares about the dbx mode...
> > 
> > >
> > > gdb/ChangeLog:
> > >
> > > 	* stack.c (func_command): Return early when there is no ARG
> > > 	string.
> > >
> > > gdb/testsuite/ChangeLog:
> > >
> > > 	* gdb.base/dbx.exp (test_func): Remove xfails, update
> > expected
> > > 	results.
> > 
> > OK.
> 
> Actually dbx style func still fails on ARM so this changes shows up
> as a regression (XFAIL- > FAIL). See [1] for a bit more details.

The failure you're seeing on ARM, where gdb says "Target is
executing." seems pretty strange, and certainly isn't the failure that
I would have expected before, this looks like a different issue, which
is probably worth some investigation.  I'm guessing here, but I doubt
that the original XFAIL I removed was intended to mask this specific
failure.

It would probably help to diagnose this issue if you could attach a
gdb.log for a test run of dbx.exp.

Thanks,
Andrew
diff mbox

Patch

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 50aa7f0..7c4b567 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@ 
 2015-09-11  Andrew Burgess  <andrew.burgess@embecosm.com>
 
+	* stack.c (func_command): Return early when there is no ARG
+	string.
+
+2015-09-11  Andrew Burgess  <andrew.burgess@embecosm.com>
+
 	* stack.c: Include safe-ctype.h not ctype.h.
 	(parse_frame_specification): Use ISSPACE not isspace.
 	(backtrace_command): Use TOLOWER not tolower.
diff --git a/gdb/stack.c b/gdb/stack.c
index 2fe176f..1049995 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -2527,7 +2527,7 @@  func_command (char *arg, int from_tty)
   struct function_bounds *func_bounds = NULL;
   struct cleanup *cleanups;
 
-  if (arg != NULL)
+  if (arg == NULL)
     return;
 
   frame = parse_frame_specification ("0");
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index ee0ad76..272d3fc 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,10 @@ 
 2015-09-11  Andrew Burgess  <andrew.burgess@embecosm.com>
 
+	* gdb.base/dbx.exp (test_func): Remove xfails, update expected
+	results.
+
+2015-09-11  Andrew Burgess  <andrew.burgess@embecosm.com>
+
 	* gdb.base/create-frame.exp: Add test for 'info frame' with
 	specific address.
 
diff --git a/gdb/testsuite/gdb.base/dbx.exp b/gdb/testsuite/gdb.base/dbx.exp
index 19dba62..75cb0fd 100644
--- a/gdb/testsuite/gdb.base/dbx.exp
+++ b/gdb/testsuite/gdb.base/dbx.exp
@@ -293,15 +293,11 @@  proc test_func { } {
     global srcfile2
     gdb_test "cont" ".*" "cont 1"
     gdb_test "step" ".*"
-    # This always fails, but it's not clear why. -sts 1999-08-17
-    setup_xfail "*-*-*"
     gdb_test "func sum" "'sum' not within current stack frame\."
     set stop_line [gdb_get_line_number "stop-in-sum" $srcfile2]
     gdb_test "stop in sum" "Breakpoint.*at.*: file.*sum\.c, line $stop_line\."
     gdb_test "cont" ".*" "cont 2"
-    # This always fails, but it's not clear why. -sts 1999-08-17
-    setup_xfail "*-*-*"
-    gdb_test "func print_average" ".*in print_average.*\\(list=.*, low=0, high=6\\).*at.*average\.c:${decimal}\r\n\${decimal}\[ \t\]+total = sum\\(list, low, high\\);"
+    gdb_test "func print_average" ".*in print_average.*\\(list=.*, low=0, high=6\\).*at.*average\.c:${decimal}\r\n${decimal}\[ \t\]+total = sum\\(list, low, high\\);"
 }
 
 # Start with a fresh gdb.