Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Re: [RFA] gdb.base/call-rt-st.*: Add char bitfield and short bitfield tests
@ 2003-10-11 21:26 Michael Elizabeth Chastain
  2003-10-13  9:14 ` Corinna Vinschen
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Elizabeth Chastain @ 2003-10-11 21:26 UTC (permalink / raw)
  To: ezannoni, gdb-patches, vinschen

I proofread the patch and found one copy-and-paste glitch:

    if ![gdb_skip_stdio_test "print print_bit_flags_short(*flags)"] {
	print_struct_call "print_bit_flags(*flags)" \
		".*alpha\[ \r\n\]+gamma\[ \r\n\]+epsilon\[ \r\n\]+.\[0-9\]+ = \\{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\\}"
    }

The second line should be "print_struct_call print_bit_flags_short".

My test bed likes this patch.

Recommended for approval, with this change.

Michael C

===

	* gdb.base/call-rt-st.c (struct bit_flags_char_t): New bitfield
	type, based on char type.
	(struct bit_flags_short_t): New bitfield type, based on short type.
	(init_bit_flags_char): New fuction.
	(init_bit_flags_short): Ditto.
	(print_bit_flags_char): Ditto.
	(print_bit_flags_short): Ditto.
	(main): Add handling for bit_flags_char_t and bit_flags_short_t.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFA] gdb.base/call-rt-st.*: Add char bitfield and short bitfield tests
  2003-10-11 21:26 [RFA] gdb.base/call-rt-st.*: Add char bitfield and short bitfield tests Michael Elizabeth Chastain
@ 2003-10-13  9:14 ` Corinna Vinschen
  0 siblings, 0 replies; 4+ messages in thread
From: Corinna Vinschen @ 2003-10-13  9:14 UTC (permalink / raw)
  To: gdb-patches

On Sat, Oct 11, 2003 at 05:26:17PM -0400, Michael Elizabeth Chastain wrote:
> I proofread the patch and found one copy-and-paste glitch:
> 
>     if ![gdb_skip_stdio_test "print print_bit_flags_short(*flags)"] {
> 	print_struct_call "print_bit_flags(*flags)" \
> 		".*alpha\[ \r\n\]+gamma\[ \r\n\]+epsilon\[ \r\n\]+.\[0-9\]+ = \\{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\\}"
>     }
> 
> The second line should be "print_struct_call print_bit_flags_short".
> 
> My test bed likes this patch.
> 
> Recommended for approval, with this change.

Changed and applied.

Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Developer
Red Hat, Inc.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFA] gdb.base/call-rt-st.*: Add char bitfield and short bitfield tests
  2003-10-10 17:18 Corinna Vinschen
@ 2003-10-10 17:59 ` Elena Zannoni
  0 siblings, 0 replies; 4+ messages in thread
From: Elena Zannoni @ 2003-10-10 17:59 UTC (permalink / raw)
  To: gdb-patches

Corinna Vinschen writes:
 > Hi,
 > 
 > as talked about in the thread
 > 
 > "[RFA] sh-tdep.c (sh_use_struct_convention): Restructure and fix",
 > 
 > the call-rt-st.exp test has no test about correct handling of bitfields
 > with base types char and short.  The below patch basically just adds
 > appropriate bitfields and functions, calls them in call-rt-st.exp and
 > fixes the line numbering in call-rt-st.exp accordingly.

Yes, if MichaelC sends it through his test harness and says so as well.

elena



 > 
 > Corinna
 > 
 > 	* gdb.base/call-rt-st.c (struct bit_flags_char_t): New bitfield
 > 	type, based on char type.
 > 	(struct bit_flags_short_t): New bitfield type, based on short type.
 > 	(init_bit_flags_char): New fuction.
 > 	(init_bit_flags_short): Ditto.
 > 	(print_bit_flags_char): Ditto.
 > 	(print_bit_flags_short): Ditto.
 > 	(main): Add handling for bit_flags_char_t and bit_flags_short_t.
 > 
 > Index: gdb.base/call-rt-st.c
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/testsuite/gdb.base/call-rt-st.c,v
 > retrieving revision 1.1.1.2
 > diff -u -p -r1.1.1.2 call-rt-st.c
 > --- gdb.base/call-rt-st.c	28 Jun 1999 16:02:47 -0000	1.1.1.2
 > +++ gdb.base/call-rt-st.c	10 Oct 2003 17:17:37 -0000
 > @@ -31,6 +31,28 @@ struct small_rep_info_t {
 >     int   head;
 >  };
 >  
 > +/* 6 bits : really fits in 8 bits and is promoted to 8 bits
 > + */
 > +struct bit_flags_char_t {
 > +       unsigned char alpha   :1;
 > +       unsigned char beta    :1;
 > +       unsigned char gamma   :1;
 > +       unsigned char delta   :1;
 > +       unsigned char epsilon :1;
 > +       unsigned char omega   :1;
 > +};
 > +
 > +/* 6 bits : really fits in 8 bits and is promoted to 16 bits
 > + */
 > +struct bit_flags_short_t {
 > +       unsigned short alpha   :1;
 > +       unsigned short beta    :1;
 > +       unsigned short gamma   :1;
 > +       unsigned short delta   :1;
 > +       unsigned short epsilon :1;
 > +       unsigned short omega   :1;
 > +};
 > +
 >  /* 6 bits : really fits in 8 bits and is promoted to 32 bits
 >   */
 >  struct bit_flags_t {
 > @@ -107,6 +129,90 @@ void loop_count () {
 >  }
 >  
 >  /*****************************************************************
 > + * INIT_BIT_FLAGS_CHAR :
 > + * Initializes a bit_flags_char_t structure. Can call this function see
 > + * the call command behavior when integer arguments do not fit into
 > + * registers and must be placed on the stack.
 > + * OUT struct bit_flags_char_t *bit_flags -- structure to be filled
 > + * IN  unsigned a  -- 0 or 1 
 > + * IN  unsigned b  -- 0 or 1 
 > + * IN  unsigned g  -- 0 or 1 
 > + * IN  unsigned d  -- 0 or 1 
 > + * IN  unsigned e  -- 0 or 1 
 > + * IN  unsigned o  -- 0 or 1 
 > + *****************************************************************/
 > +#ifdef PROTOTYPES
 > +void init_bit_flags_char (
 > +struct bit_flags_char_t *bit_flags,
 > +unsigned a,
 > +unsigned b,
 > +unsigned g,
 > +unsigned d,
 > +unsigned e,
 > +unsigned o)
 > +#else
 > +void init_bit_flags_char (bit_flags,a,b,g,d,e,o) 
 > +struct bit_flags_char_t *bit_flags;
 > +unsigned a;
 > +unsigned b;
 > +unsigned g;
 > +unsigned d;
 > +unsigned e;
 > +unsigned o; 
 > +#endif
 > +{
 > +
 > +   bit_flags->alpha = a;
 > +   bit_flags->beta = b;
 > +   bit_flags->gamma = g;
 > +   bit_flags->delta = d;
 > +   bit_flags->epsilon = e;
 > +   bit_flags->omega = o;
 > +}
 > +
 > +/*****************************************************************
 > + * INIT_BIT_FLAGS_SHORT :
 > + * Initializes a bit_flags_short_t structure. Can call this function see
 > + * the call command behavior when integer arguments do not fit into
 > + * registers and must be placed on the stack.
 > + * OUT struct bit_flags_short_t *bit_flags -- structure to be filled
 > + * IN  unsigned a  -- 0 or 1 
 > + * IN  unsigned b  -- 0 or 1 
 > + * IN  unsigned g  -- 0 or 1 
 > + * IN  unsigned d  -- 0 or 1 
 > + * IN  unsigned e  -- 0 or 1 
 > + * IN  unsigned o  -- 0 or 1 
 > + *****************************************************************/
 > +#ifdef PROTOTYPES
 > +void init_bit_flags_short (
 > +struct bit_flags_short_t *bit_flags,
 > +unsigned a,
 > +unsigned b,
 > +unsigned g,
 > +unsigned d,
 > +unsigned e,
 > +unsigned o)
 > +#else
 > +void init_bit_flags_short (bit_flags,a,b,g,d,e,o) 
 > +struct bit_flags_short_t *bit_flags;
 > +unsigned a;
 > +unsigned b;
 > +unsigned g;
 > +unsigned d;
 > +unsigned e;
 > +unsigned o; 
 > +#endif
 > +{
 > +
 > +   bit_flags->alpha = a;
 > +   bit_flags->beta = b;
 > +   bit_flags->gamma = g;
 > +   bit_flags->delta = d;
 > +   bit_flags->epsilon = e;
 > +   bit_flags->omega = o;
 > +}
 > +
 > +/*****************************************************************
 >   * INIT_BIT_FLAGS :
 >   * Initializes a bit_flags_t structure. Can call this function see
 >   * the call command behavior when integer arguments do not fit into
 > @@ -345,6 +451,50 @@ int    seed;
 >  }
 >  
 >  /*****************************************************************
 > + * PRINT_BIT_FLAGS_CHAR : 
 > + * IN struct bit_flags_char_t bit_flags 
 > + ****************************************************************/
 > +#ifdef PROTOTYPES
 > +struct bit_flags_char_t print_bit_flags_char (struct bit_flags_char_t bit_flags)
 > +#else
 > +struct bit_flags_char_t print_bit_flags_char ( bit_flags)
 > +struct bit_flags_char_t bit_flags;
 > +#endif
 > +{
 > +
 > +     if (bit_flags.alpha) printf("alpha\n");
 > +     if (bit_flags.beta) printf("beta\n");
 > +     if (bit_flags.gamma) printf("gamma\n");
 > +     if (bit_flags.delta) printf("delta\n");
 > +     if (bit_flags.epsilon) printf("epsilon\n");
 > +     if (bit_flags.omega) printf("omega\n");
 > +     return bit_flags;
 > +     
 > +}
 > +
 > +/*****************************************************************
 > + * PRINT_BIT_FLAGS_SHORT : 
 > + * IN struct bit_flags_short_t bit_flags 
 > + ****************************************************************/
 > +#ifdef PROTOTYPES
 > +struct bit_flags_short_t print_bit_flags_short (struct bit_flags_short_t bit_flags)
 > +#else
 > +struct bit_flags_short_t print_bit_flags_short ( bit_flags)
 > +struct bit_flags_short_t bit_flags;
 > +#endif
 > +{
 > +
 > +     if (bit_flags.alpha) printf("alpha\n");
 > +     if (bit_flags.beta) printf("beta\n");
 > +     if (bit_flags.gamma) printf("gamma\n");
 > +     if (bit_flags.delta) printf("delta\n");
 > +     if (bit_flags.epsilon) printf("epsilon\n");
 > +     if (bit_flags.omega) printf("omega\n");
 > +     return bit_flags;
 > +     
 > +}
 > +
 > +/*****************************************************************
 >   * PRINT_BIT_FLAGS : 
 >   * IN struct bit_flags_t bit_flags 
 >   ****************************************************************/
 > @@ -553,6 +703,8 @@ int main ()  {
 >    /* variables for testing a small structures and a very long argument list
 >     */
 >     struct small_rep_info_t  *struct1;
 > +   struct bit_flags_char_t  *cflags;
 > +   struct bit_flags_short_t *sflags;
 >     struct bit_flags_t       *flags;
 >     struct bit_flags_combo_t *flags_combo;
 >     struct three_char_t      *three_char;
 > @@ -577,6 +729,8 @@ int main ()  {
 >    /* Allocate space for small structures 
 >     */
 >    struct1     = (struct small_rep_info_t  *)malloc(sizeof(struct small_rep_info_t));
 > +  cflags       = (struct bit_flags_char_t *)malloc(sizeof(struct bit_flags_char_t));
 > +  sflags       = (struct bit_flags_short_t *)malloc(sizeof(struct bit_flags_short_t));
 >    flags       = (struct bit_flags_t *)malloc(sizeof(struct bit_flags_t));
 >    flags_combo = (struct bit_flags_combo_t *)malloc(sizeof(struct bit_flags_combo_t));
 >    three_char  = (struct three_char_t *)malloc(sizeof(struct three_char_t));
 > @@ -590,6 +744,10 @@ int main ()  {
 >     */
 >    init_one_double ( d1, 1.11111); 
 >    init_two_floats ( f3, -2.345, 1.0); 
 > +  init_bit_flags_char(cflags, (unsigned)1, (unsigned)0, (unsigned)1, 
 > +		      (unsigned)0, (unsigned)1, (unsigned)0 ); 
 > +  init_bit_flags_short(sflags, (unsigned)1, (unsigned)0, (unsigned)1, 
 > +		       (unsigned)0, (unsigned)1, (unsigned)0 ); 
 >    init_bit_flags(flags, (unsigned)1, (unsigned)0, (unsigned)1, 
 >  		 (unsigned)0, (unsigned)1, (unsigned)0 ); 
 >    init_bit_flags_combo(flags_combo, (unsigned)1, (unsigned)0, 'y',
 > @@ -605,6 +763,8 @@ int main ()  {
 >     */
 >    print_one_double(*d1);
 >    print_two_floats(*f3);
 > +  print_bit_flags_char(*cflags);
 > +  print_bit_flags_short(*sflags);
 >    print_bit_flags(*flags);
 >    print_bit_flags_combo(*flags_combo);
 >    print_three_chars(*three_char);
 > Index: gdb.base/call-rt-st.exp
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/testsuite/gdb.base/call-rt-st.exp,v
 > retrieving revision 1.12
 > diff -u -p -r1.12 call-rt-st.exp
 > --- gdb.base/call-rt-st.exp	3 Apr 2003 16:34:48 -0000	1.12
 > +++ gdb.base/call-rt-st.exp	10 Oct 2003 17:17:37 -0000
 > @@ -114,13 +114,13 @@ if ![runto_main] then {
 >  
 >  
 >  gdb_test "break loop_count" \
 > -    "Breakpoint.* file .*call-rt-st.c, line 106\\." \
 > +    "Breakpoint.* file .*call-rt-st.c, line 128\\." \
 >      "breakpoint loop_count"
 >  
 >  
 >  send_gdb "continue\n"
 >  gdb_expect {
 > - -re  "Continuing\\..*Breakpoint.*loop_count \\(\\) at.*call-rt-st.c:106\[ \t\r\n\]+106\[\t \]+for \\(index=0; index.4; index..\\);\[\r\n \]+$gdb_prompt $" {
 > + -re  "Continuing\\..*Breakpoint.*loop_count \\(\\) at.*call-rt-st.c:128\[ \t\r\n\]+128\[\t \]+for \\(index=0; index.4; index..\\);\[\r\n \]+$gdb_prompt $" {
 >                   pass "continue to loop_count"}
 >        -re ".*$gdb_prompt $" { fail "continue to loop_count"}           
 >        timeout           { fail "(timeout) continue to loop_count"}
 > @@ -128,11 +128,11 @@ gdb_expect {
 >  
 >  send_gdb "finish\n"
 >  gdb_expect {
 > -    -re  "Run till exit from .0  loop_count \\(\\) at.*call-rt-st.c:106\[ \t\r\n\]+main \\(\\) at.*call-rt-st.c:617\[ \t\r\n\]+617\[\t \]+return 0;.*$gdb_prompt $" {
 > -	pass "finish out from loop_count (line 617)"
 > +    -re  "Run till exit from .0  loop_count \\(\\) at.*call-rt-st.c:128\[ \t\r\n\]+main \\(\\) at.*call-rt-st.c:777\[ \t\r\n\]+777\[\t \]+return 0;.*$gdb_prompt $" {
 > +	pass "finish out from loop_count (line 777)"
 >      }
 > -    -re  "Run till exit from .0  loop_count \\(\\) at.*call-rt-st.c:106\[ \t\r\n\]+main \\(\\) at.*call-rt-st.c:615\[ \t\r\n\]+615\[\t \]+loop_count.*$gdb_prompt $" {
 > -	pass "finish out from loop_count (line 615)"
 > +    -re  "Run till exit from .0  loop_count \\(\\) at.*call-rt-st.c:128\[ \t\r\n\]+main \\(\\) at.*call-rt-st.c:775\[ \t\r\n\]+775\[\t \]+loop_count.*$gdb_prompt $" {
 > +	pass "finish out from loop_count (line 775)"
 >      }
 >      -re ".*$gdb_prompt $" {
 >  	fail "finish out from loop_count"
 > @@ -189,6 +189,16 @@ if {![gdb_skip_float_test "print print_t
 >          ![gdb_skip_stdio_test "print print_two_floats(*f3)"] } {
 >      print_struct_call "print_two_floats(*f3)" \
 >              ".*Contents of two_floats_t:\[ \r\n\]+-2\\.345000\[ \t]+1\\.000000\[ \r\n\]+.\[0-9\]+ = \\{float1 = -2\\.34500003, float2 = 1\\}"
 > +}
 > +
 > +if ![gdb_skip_stdio_test "print print_bit_flags_char(*flags)"] {
 > +    print_struct_call "print_bit_flags_char(*flags)" \
 > +            ".*alpha\[ \r\n\]+gamma\[ \r\n\]+epsilon\[ \r\n\]+.\[0-9\]+ = \\{alpha = 1 '\\\\001', beta = 0 '\\\\0', gamma = 1 '\\\\001', delta = 0 '\\\\0', epsilon = 1 '\\\\001', omega = 0 '\\\\0'\\}"
 > +}
 > +
 > +if ![gdb_skip_stdio_test "print print_bit_flags_short(*flags)"] {
 > +    print_struct_call "print_bit_flags(*flags)" \
 > +            ".*alpha\[ \r\n\]+gamma\[ \r\n\]+epsilon\[ \r\n\]+.\[0-9\]+ = \\{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\\}"
 >  }
 >  
 >  if ![gdb_skip_stdio_test "print print_bit_flags(*flags)"] {
 > 
 > -- 
 > Corinna Vinschen
 > Cygwin Developer
 > Red Hat, Inc.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [RFA] gdb.base/call-rt-st.*: Add char bitfield and short bitfield tests
@ 2003-10-10 17:18 Corinna Vinschen
  2003-10-10 17:59 ` Elena Zannoni
  0 siblings, 1 reply; 4+ messages in thread
From: Corinna Vinschen @ 2003-10-10 17:18 UTC (permalink / raw)
  To: gdb-patches

Hi,

as talked about in the thread

"[RFA] sh-tdep.c (sh_use_struct_convention): Restructure and fix",

the call-rt-st.exp test has no test about correct handling of bitfields
with base types char and short.  The below patch basically just adds
appropriate bitfields and functions, calls them in call-rt-st.exp and
fixes the line numbering in call-rt-st.exp accordingly.

Corinna

	* gdb.base/call-rt-st.c (struct bit_flags_char_t): New bitfield
	type, based on char type.
	(struct bit_flags_short_t): New bitfield type, based on short type.
	(init_bit_flags_char): New fuction.
	(init_bit_flags_short): Ditto.
	(print_bit_flags_char): Ditto.
	(print_bit_flags_short): Ditto.
	(main): Add handling for bit_flags_char_t and bit_flags_short_t.

Index: gdb.base/call-rt-st.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/call-rt-st.c,v
retrieving revision 1.1.1.2
diff -u -p -r1.1.1.2 call-rt-st.c
--- gdb.base/call-rt-st.c	28 Jun 1999 16:02:47 -0000	1.1.1.2
+++ gdb.base/call-rt-st.c	10 Oct 2003 17:17:37 -0000
@@ -31,6 +31,28 @@ struct small_rep_info_t {
    int   head;
 };
 
+/* 6 bits : really fits in 8 bits and is promoted to 8 bits
+ */
+struct bit_flags_char_t {
+       unsigned char alpha   :1;
+       unsigned char beta    :1;
+       unsigned char gamma   :1;
+       unsigned char delta   :1;
+       unsigned char epsilon :1;
+       unsigned char omega   :1;
+};
+
+/* 6 bits : really fits in 8 bits and is promoted to 16 bits
+ */
+struct bit_flags_short_t {
+       unsigned short alpha   :1;
+       unsigned short beta    :1;
+       unsigned short gamma   :1;
+       unsigned short delta   :1;
+       unsigned short epsilon :1;
+       unsigned short omega   :1;
+};
+
 /* 6 bits : really fits in 8 bits and is promoted to 32 bits
  */
 struct bit_flags_t {
@@ -107,6 +129,90 @@ void loop_count () {
 }
 
 /*****************************************************************
+ * INIT_BIT_FLAGS_CHAR :
+ * Initializes a bit_flags_char_t structure. Can call this function see
+ * the call command behavior when integer arguments do not fit into
+ * registers and must be placed on the stack.
+ * OUT struct bit_flags_char_t *bit_flags -- structure to be filled
+ * IN  unsigned a  -- 0 or 1 
+ * IN  unsigned b  -- 0 or 1 
+ * IN  unsigned g  -- 0 or 1 
+ * IN  unsigned d  -- 0 or 1 
+ * IN  unsigned e  -- 0 or 1 
+ * IN  unsigned o  -- 0 or 1 
+ *****************************************************************/
+#ifdef PROTOTYPES
+void init_bit_flags_char (
+struct bit_flags_char_t *bit_flags,
+unsigned a,
+unsigned b,
+unsigned g,
+unsigned d,
+unsigned e,
+unsigned o)
+#else
+void init_bit_flags_char (bit_flags,a,b,g,d,e,o) 
+struct bit_flags_char_t *bit_flags;
+unsigned a;
+unsigned b;
+unsigned g;
+unsigned d;
+unsigned e;
+unsigned o; 
+#endif
+{
+
+   bit_flags->alpha = a;
+   bit_flags->beta = b;
+   bit_flags->gamma = g;
+   bit_flags->delta = d;
+   bit_flags->epsilon = e;
+   bit_flags->omega = o;
+}
+
+/*****************************************************************
+ * INIT_BIT_FLAGS_SHORT :
+ * Initializes a bit_flags_short_t structure. Can call this function see
+ * the call command behavior when integer arguments do not fit into
+ * registers and must be placed on the stack.
+ * OUT struct bit_flags_short_t *bit_flags -- structure to be filled
+ * IN  unsigned a  -- 0 or 1 
+ * IN  unsigned b  -- 0 or 1 
+ * IN  unsigned g  -- 0 or 1 
+ * IN  unsigned d  -- 0 or 1 
+ * IN  unsigned e  -- 0 or 1 
+ * IN  unsigned o  -- 0 or 1 
+ *****************************************************************/
+#ifdef PROTOTYPES
+void init_bit_flags_short (
+struct bit_flags_short_t *bit_flags,
+unsigned a,
+unsigned b,
+unsigned g,
+unsigned d,
+unsigned e,
+unsigned o)
+#else
+void init_bit_flags_short (bit_flags,a,b,g,d,e,o) 
+struct bit_flags_short_t *bit_flags;
+unsigned a;
+unsigned b;
+unsigned g;
+unsigned d;
+unsigned e;
+unsigned o; 
+#endif
+{
+
+   bit_flags->alpha = a;
+   bit_flags->beta = b;
+   bit_flags->gamma = g;
+   bit_flags->delta = d;
+   bit_flags->epsilon = e;
+   bit_flags->omega = o;
+}
+
+/*****************************************************************
  * INIT_BIT_FLAGS :
  * Initializes a bit_flags_t structure. Can call this function see
  * the call command behavior when integer arguments do not fit into
@@ -345,6 +451,50 @@ int    seed;
 }
 
 /*****************************************************************
+ * PRINT_BIT_FLAGS_CHAR : 
+ * IN struct bit_flags_char_t bit_flags 
+ ****************************************************************/
+#ifdef PROTOTYPES
+struct bit_flags_char_t print_bit_flags_char (struct bit_flags_char_t bit_flags)
+#else
+struct bit_flags_char_t print_bit_flags_char ( bit_flags)
+struct bit_flags_char_t bit_flags;
+#endif
+{
+
+     if (bit_flags.alpha) printf("alpha\n");
+     if (bit_flags.beta) printf("beta\n");
+     if (bit_flags.gamma) printf("gamma\n");
+     if (bit_flags.delta) printf("delta\n");
+     if (bit_flags.epsilon) printf("epsilon\n");
+     if (bit_flags.omega) printf("omega\n");
+     return bit_flags;
+     
+}
+
+/*****************************************************************
+ * PRINT_BIT_FLAGS_SHORT : 
+ * IN struct bit_flags_short_t bit_flags 
+ ****************************************************************/
+#ifdef PROTOTYPES
+struct bit_flags_short_t print_bit_flags_short (struct bit_flags_short_t bit_flags)
+#else
+struct bit_flags_short_t print_bit_flags_short ( bit_flags)
+struct bit_flags_short_t bit_flags;
+#endif
+{
+
+     if (bit_flags.alpha) printf("alpha\n");
+     if (bit_flags.beta) printf("beta\n");
+     if (bit_flags.gamma) printf("gamma\n");
+     if (bit_flags.delta) printf("delta\n");
+     if (bit_flags.epsilon) printf("epsilon\n");
+     if (bit_flags.omega) printf("omega\n");
+     return bit_flags;
+     
+}
+
+/*****************************************************************
  * PRINT_BIT_FLAGS : 
  * IN struct bit_flags_t bit_flags 
  ****************************************************************/
@@ -553,6 +703,8 @@ int main ()  {
   /* variables for testing a small structures and a very long argument list
    */
    struct small_rep_info_t  *struct1;
+   struct bit_flags_char_t  *cflags;
+   struct bit_flags_short_t *sflags;
    struct bit_flags_t       *flags;
    struct bit_flags_combo_t *flags_combo;
    struct three_char_t      *three_char;
@@ -577,6 +729,8 @@ int main ()  {
   /* Allocate space for small structures 
    */
   struct1     = (struct small_rep_info_t  *)malloc(sizeof(struct small_rep_info_t));
+  cflags       = (struct bit_flags_char_t *)malloc(sizeof(struct bit_flags_char_t));
+  sflags       = (struct bit_flags_short_t *)malloc(sizeof(struct bit_flags_short_t));
   flags       = (struct bit_flags_t *)malloc(sizeof(struct bit_flags_t));
   flags_combo = (struct bit_flags_combo_t *)malloc(sizeof(struct bit_flags_combo_t));
   three_char  = (struct three_char_t *)malloc(sizeof(struct three_char_t));
@@ -590,6 +744,10 @@ int main ()  {
    */
   init_one_double ( d1, 1.11111); 
   init_two_floats ( f3, -2.345, 1.0); 
+  init_bit_flags_char(cflags, (unsigned)1, (unsigned)0, (unsigned)1, 
+		      (unsigned)0, (unsigned)1, (unsigned)0 ); 
+  init_bit_flags_short(sflags, (unsigned)1, (unsigned)0, (unsigned)1, 
+		       (unsigned)0, (unsigned)1, (unsigned)0 ); 
   init_bit_flags(flags, (unsigned)1, (unsigned)0, (unsigned)1, 
 		 (unsigned)0, (unsigned)1, (unsigned)0 ); 
   init_bit_flags_combo(flags_combo, (unsigned)1, (unsigned)0, 'y',
@@ -605,6 +763,8 @@ int main ()  {
    */
   print_one_double(*d1);
   print_two_floats(*f3);
+  print_bit_flags_char(*cflags);
+  print_bit_flags_short(*sflags);
   print_bit_flags(*flags);
   print_bit_flags_combo(*flags_combo);
   print_three_chars(*three_char);
Index: gdb.base/call-rt-st.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/call-rt-st.exp,v
retrieving revision 1.12
diff -u -p -r1.12 call-rt-st.exp
--- gdb.base/call-rt-st.exp	3 Apr 2003 16:34:48 -0000	1.12
+++ gdb.base/call-rt-st.exp	10 Oct 2003 17:17:37 -0000
@@ -114,13 +114,13 @@ if ![runto_main] then {
 
 
 gdb_test "break loop_count" \
-    "Breakpoint.* file .*call-rt-st.c, line 106\\." \
+    "Breakpoint.* file .*call-rt-st.c, line 128\\." \
     "breakpoint loop_count"
 
 
 send_gdb "continue\n"
 gdb_expect {
- -re  "Continuing\\..*Breakpoint.*loop_count \\(\\) at.*call-rt-st.c:106\[ \t\r\n\]+106\[\t \]+for \\(index=0; index.4; index..\\);\[\r\n \]+$gdb_prompt $" {
+ -re  "Continuing\\..*Breakpoint.*loop_count \\(\\) at.*call-rt-st.c:128\[ \t\r\n\]+128\[\t \]+for \\(index=0; index.4; index..\\);\[\r\n \]+$gdb_prompt $" {
                  pass "continue to loop_count"}
       -re ".*$gdb_prompt $" { fail "continue to loop_count"}           
       timeout           { fail "(timeout) continue to loop_count"}
@@ -128,11 +128,11 @@ gdb_expect {
 
 send_gdb "finish\n"
 gdb_expect {
-    -re  "Run till exit from .0  loop_count \\(\\) at.*call-rt-st.c:106\[ \t\r\n\]+main \\(\\) at.*call-rt-st.c:617\[ \t\r\n\]+617\[\t \]+return 0;.*$gdb_prompt $" {
-	pass "finish out from loop_count (line 617)"
+    -re  "Run till exit from .0  loop_count \\(\\) at.*call-rt-st.c:128\[ \t\r\n\]+main \\(\\) at.*call-rt-st.c:777\[ \t\r\n\]+777\[\t \]+return 0;.*$gdb_prompt $" {
+	pass "finish out from loop_count (line 777)"
     }
-    -re  "Run till exit from .0  loop_count \\(\\) at.*call-rt-st.c:106\[ \t\r\n\]+main \\(\\) at.*call-rt-st.c:615\[ \t\r\n\]+615\[\t \]+loop_count.*$gdb_prompt $" {
-	pass "finish out from loop_count (line 615)"
+    -re  "Run till exit from .0  loop_count \\(\\) at.*call-rt-st.c:128\[ \t\r\n\]+main \\(\\) at.*call-rt-st.c:775\[ \t\r\n\]+775\[\t \]+loop_count.*$gdb_prompt $" {
+	pass "finish out from loop_count (line 775)"
     }
     -re ".*$gdb_prompt $" {
 	fail "finish out from loop_count"
@@ -189,6 +189,16 @@ if {![gdb_skip_float_test "print print_t
         ![gdb_skip_stdio_test "print print_two_floats(*f3)"] } {
     print_struct_call "print_two_floats(*f3)" \
             ".*Contents of two_floats_t:\[ \r\n\]+-2\\.345000\[ \t]+1\\.000000\[ \r\n\]+.\[0-9\]+ = \\{float1 = -2\\.34500003, float2 = 1\\}"
+}
+
+if ![gdb_skip_stdio_test "print print_bit_flags_char(*flags)"] {
+    print_struct_call "print_bit_flags_char(*flags)" \
+            ".*alpha\[ \r\n\]+gamma\[ \r\n\]+epsilon\[ \r\n\]+.\[0-9\]+ = \\{alpha = 1 '\\\\001', beta = 0 '\\\\0', gamma = 1 '\\\\001', delta = 0 '\\\\0', epsilon = 1 '\\\\001', omega = 0 '\\\\0'\\}"
+}
+
+if ![gdb_skip_stdio_test "print print_bit_flags_short(*flags)"] {
+    print_struct_call "print_bit_flags(*flags)" \
+            ".*alpha\[ \r\n\]+gamma\[ \r\n\]+epsilon\[ \r\n\]+.\[0-9\]+ = \\{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\\}"
 }
 
 if ![gdb_skip_stdio_test "print print_bit_flags(*flags)"] {

-- 
Corinna Vinschen
Cygwin Developer
Red Hat, Inc.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-10-13  9:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-11 21:26 [RFA] gdb.base/call-rt-st.*: Add char bitfield and short bitfield tests Michael Elizabeth Chastain
2003-10-13  9:14 ` Corinna Vinschen
  -- strict thread matches above, loose matches on Subject: below --
2003-10-10 17:18 Corinna Vinschen
2003-10-10 17:59 ` Elena Zannoni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox