Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: Nick Roberts <nickrob@snap.net.nz>, gdb-patches@sourceware.org
Subject: Re: mi-var-child failures
Date: Wed, 16 Jan 2008 18:48:00 -0000	[thread overview]
Message-ID: <478E35B5.5060608@codesourcery.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 466 bytes --]

[moving to gdb-patches]

Nick wrote:
>Vladimir wrote:
>> This is not a problem with GDB -- it's acting right, so FAIL on embedded
>> target is not indicative of a problem. I think we get to fix the testcase
>> itself.
>> 
>> Mind if I make the pointer point to valid memory on all systems?
>
>That seems sensible to me.


Here is a patch to do that.

Tested on i686-pc-linux-gnu, no changes; and arm-none-eabi, where it
removes the failures.

OK?

-- 
Pedro Alves



[-- Attachment #2: mivarchild.diff --]
[-- Type: text/x-patch, Size: 3941 bytes --]

2008-01-16  Pedro Alves  <pedro@codesourcery.com>

	* gdb.mi/mi-var-child.c (do_children_tests): Add 'dummy' integer
	and 'dummy_ptr' integer pointer.  Initialize struct_declarations
	with dummy_ptr's address.
	* gdb.mi/var-cmd.c (do_children_tests): Likewise.
	* gdb.mi/mi-var-child.exp: int_ptr_ptr is now always "editable" on
	all targets.
	* gdb.mi/mi2-var-child.exp: Likewise.

---
 gdb/testsuite/gdb.mi/mi-var-child.c    |    8 ++++++--
 gdb/testsuite/gdb.mi/mi-var-child.exp  |    4 ++--
 gdb/testsuite/gdb.mi/mi2-var-child.exp |    4 ++--
 gdb/testsuite/gdb.mi/var-cmd.c         |    8 ++++++--
 4 files changed, 16 insertions(+), 8 deletions(-)

Index: src/gdb/testsuite/gdb.mi/mi-var-child.c
===================================================================
--- src.orig/gdb/testsuite/gdb.mi/mi-var-child.c	2008-01-16 10:48:35.000000000 -0500
+++ src/gdb/testsuite/gdb.mi/mi-var-child.c	2008-01-16 11:27:37.000000000 -0500
@@ -206,8 +206,12 @@ do_children_tests (void)
   int *foo;
   int bar;
 
-  struct _struct_decl struct_declarations;
-  memset (&struct_declarations, 0, sizeof (struct_declarations));
+  /* Avoid pointing into NULL, as that is editable on some
+     systems.  */
+  int dummy;
+  int *dummy_ptr = &dummy;
+
+  struct _struct_decl struct_declarations = { 0, 0, NULL, 0, &dummy_ptr };
   weird = &struct_declarations;
 
   struct_declarations.integer = 123;
Index: src/gdb/testsuite/gdb.mi/mi-var-child.exp
===================================================================
--- src.orig/gdb/testsuite/gdb.mi/mi-var-child.exp	2008-01-16 10:48:35.000000000 -0500
+++ src/gdb/testsuite/gdb.mi/mi-var-child.exp	2008-01-16 10:50:44.000000000 -0500
@@ -682,13 +682,13 @@ mi_gdb_test "-var-show-attributes weird-
 # Test: c_variable-4.99
 # Desc: is *(weird->int_ptr_ptr) editable
 mi_gdb_test "-var-show-attributes weird.int_ptr_ptr.*int_ptr_ptr" \
-	"\\^done,attr=\"noneditable\"" \
+	"\\^done,attr=\"editable\"" \
 	"is weird.int_ptr_ptr.*int_ptr_ptr editable"
 
 # Test: c_variable-4.100
 # Desc: is *(*(weird->int_ptr_ptr)) editable
 mi_gdb_test "-var-show-attributes weird.int_ptr_ptr.*int_ptr_ptr.**int_ptr_ptr" \
-	"\\^done,attr=\"noneditable\"" \
+	"\\^done,attr=\"editable\"" \
 	"is weird.int_ptr_ptr.*int_ptr_ptr.**int_ptr_ptr editable"
 
 # Test: c_variable-4.101
Index: src/gdb/testsuite/gdb.mi/mi2-var-child.exp
===================================================================
--- src.orig/gdb/testsuite/gdb.mi/mi2-var-child.exp	2008-01-16 11:23:13.000000000 -0500
+++ src/gdb/testsuite/gdb.mi/mi2-var-child.exp	2008-01-16 11:26:27.000000000 -0500
@@ -681,13 +681,13 @@ mi_gdb_test "-var-show-attributes weird-
 # Test: c_variable-4.99
 # Desc: is *(weird->int_ptr_ptr) editable
 mi_gdb_test "-var-show-attributes weird.int_ptr_ptr.*int_ptr_ptr" \
-	"\\^done,attr=\"noneditable\"" \
+	"\\^done,attr=\"editable\"" \
 	"is weird.int_ptr_ptr.*int_ptr_ptr editable"
 
 # Test: c_variable-4.100
 # Desc: is *(*(weird->int_ptr_ptr)) editable
 mi_gdb_test "-var-show-attributes weird.int_ptr_ptr.*int_ptr_ptr.**int_ptr_ptr" \
-	"\\^done,attr=\"noneditable\"" \
+	"\\^done,attr=\"editable\"" \
 	"is weird.int_ptr_ptr.*int_ptr_ptr.**int_ptr_ptr editable"
 
 # Test: c_variable-4.101
Index: src/gdb/testsuite/gdb.mi/var-cmd.c
===================================================================
--- src.orig/gdb/testsuite/gdb.mi/var-cmd.c	2008-01-16 11:24:32.000000000 -0500
+++ src/gdb/testsuite/gdb.mi/var-cmd.c	2008-01-16 11:27:17.000000000 -0500
@@ -210,8 +210,12 @@ do_children_tests (void)
   int *foo;
   int bar;
 
-  struct _struct_decl struct_declarations;
-  memset (&struct_declarations, 0, sizeof (struct_declarations));
+  /* Avoid pointing into NULL, as that is editable on some
+     systems.  */
+  int dummy;
+  int *dummy_ptr = &dummy;
+
+  struct _struct_decl struct_declarations = { 0, 0, NULL, 0, &dummy_ptr };
   weird = &struct_declarations;
 
   struct_declarations.integer = 123;

             reply	other threads:[~2008-01-16 18:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-16 18:48 Pedro Alves [this message]
2008-01-16 18:56 ` Daniel Jacobowitz
2008-01-17 14:36   ` Pedro Alves

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=478E35B5.5060608@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=nickrob@snap.net.nz \
    /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