diff options
-rw-r--r-- | gdb/testsuite/ChangeLog | 11 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/call-rt-st.c | 160 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/call-rt-st.exp | 22 |
3 files changed, 187 insertions, 6 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index a5a1c49..4807d7f 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2003-10-13 Corinna Vinschen <vinschen@redhat.com> + + * 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. + 2003-10-11 Michael Chastain <mec@shout.net> * gdb.base/call-rt-st.exp: Update copyright year. diff --git a/gdb/testsuite/gdb.base/call-rt-st.c b/gdb/testsuite/gdb.base/call-rt-st.c index 712f70e..09dd5bb 100644 --- a/gdb/testsuite/gdb.base/call-rt-st.c +++ b/gdb/testsuite/gdb.base/call-rt-st.c @@ -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); diff --git a/gdb/testsuite/gdb.base/call-rt-st.exp b/gdb/testsuite/gdb.base/call-rt-st.exp index 388954f..39242fd 100644 --- a/gdb/testsuite/gdb.base/call-rt-st.exp +++ b/gdb/testsuite/gdb.base/call-rt-st.exp @@ -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" @@ -191,6 +191,16 @@ if {![gdb_skip_float_test "print 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_short(*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)"] { 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\\}" |