OLD | NEW |
1 /* Copyright 1999, 2004, 2007-2012 Free Software Foundation, Inc. | 1 /* Copyright 1999, 2004, 2007-2012 Free Software Foundation, Inc. |
2 | 2 |
3 This file is part of GDB. | 3 This file is part of GDB. |
4 | 4 |
5 This program is free software; you can redistribute it and/or modify | 5 This program is free software; you can redistribute it and/or modify |
6 it under the terms of the GNU General Public License as published by | 6 it under the terms of the GNU General Public License as published by |
7 the Free Software Foundation; either version 3 of the License, or | 7 the Free Software Foundation; either version 3 of the License, or |
8 (at your option) any later version. | 8 (at your option) any later version. |
9 | 9 |
10 This program is distributed in the hope that it will be useful, | 10 This program is distributed in the hope that it will be useful, |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 } s2; | 84 } s2; |
85 } weird_struct; | 85 } weird_struct; |
86 | 86 |
87 struct _struct_n_pointer { | 87 struct _struct_n_pointer { |
88 char ****char_ptr; | 88 char ****char_ptr; |
89 long ****long_ptr; | 89 long ****long_ptr; |
90 struct _struct_n_pointer *ptrs[3]; | 90 struct _struct_n_pointer *ptrs[3]; |
91 struct _struct_n_pointer *next; | 91 struct _struct_n_pointer *next; |
92 }; | 92 }; |
93 | 93 |
| 94 struct anonymous { |
| 95 int a; |
| 96 struct { |
| 97 int b; |
| 98 char *c; |
| 99 union { |
| 100 int d; |
| 101 void *e; |
| 102 char f; |
| 103 struct { |
| 104 char g; |
| 105 const char **h; |
| 106 simpleton ***simple; |
| 107 }; |
| 108 }; |
| 109 }; |
| 110 }; |
| 111 |
94 void do_locals_tests (void); | 112 void do_locals_tests (void); |
95 void do_block_tests (void); | 113 void do_block_tests (void); |
96 void subroutine1 (int, long *); | 114 void subroutine1 (int, long *); |
97 void nothing (void); | 115 void nothing (void); |
98 void do_children_tests (void); | 116 void do_children_tests (void); |
99 void do_special_tests (void); | 117 void do_special_tests (void); |
100 void incr_a (char); | 118 void incr_a (char); |
101 | 119 |
102 void incr_a (char a) | 120 void incr_a (char a) |
103 { | 121 { |
(...skipping 11 matching lines...) Expand all Loading... |
115 int linteger = 0; | 133 int linteger = 0; |
116 int *lpinteger = 0; | 134 int *lpinteger = 0; |
117 char lcharacter[2] = { 0, 0 }; | 135 char lcharacter[2] = { 0, 0 }; |
118 char *lpcharacter = 0; | 136 char *lpcharacter = 0; |
119 long llong = 0; | 137 long llong = 0; |
120 long *lplong = 0; | 138 long *lplong = 0; |
121 float lfloat = 0; | 139 float lfloat = 0; |
122 float *lpfloat = 0; | 140 float *lpfloat = 0; |
123 double ldouble = 0; | 141 double ldouble = 0; |
124 double *lpdouble = 0; | 142 double *lpdouble = 0; |
125 struct _simple_struct lsimple; | 143 struct _simple_struct lsimple = { 0 }; |
126 struct _simple_struct *lpsimple; | 144 struct _simple_struct *lpsimple = 0; |
127 void (*func) (void); | 145 void (*func) (void) = 0; |
128 | 146 |
129 /* Simple assignments */ | 147 /* Simple assignments */ |
130 linteger = 1234; | 148 linteger = 1234; |
131 lpinteger = &linteger; | 149 lpinteger = &linteger; |
132 lcharacter[0] = 'a'; | 150 lcharacter[0] = 'a'; |
133 lpcharacter = lcharacter; | 151 lpcharacter = lcharacter; |
134 llong = 2121L; | 152 llong = 2121L; |
135 lplong = &llong; | 153 lplong = &llong; |
136 lfloat = 2.1; | 154 lfloat = 2.1; |
137 lpfloat = &lfloat; | 155 lpfloat = &lfloat; |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 mi_list_varobj_children "V" { | 513 mi_list_varobj_children "V" { |
496 {"V.alloc" "alloc" "0" "int"} | 514 {"V.alloc" "alloc" "0" "int"} |
497 {"V.sharable" "sharable" "0" "uint_for_mi_testing"} | 515 {"V.sharable" "sharable" "0" "uint_for_mi_testing"} |
498 } "list children of Data" | 516 } "list children of Data" |
499 mi_check_varobj_value V.sharable 3 "access bitfield" | 517 mi_check_varobj_value V.sharable 3 "access bitfield" |
500 :*/ | 518 :*/ |
501 return; | 519 return; |
502 /*: END: bitfield :*/ | 520 /*: END: bitfield :*/ |
503 } | 521 } |
504 | 522 |
| 523 void |
| 524 do_anonymous_type_tests (void) |
| 525 { |
| 526 struct anonymous *anon; |
| 527 struct anonymous **ptr; |
| 528 struct |
| 529 { |
| 530 int x; |
| 531 struct |
| 532 { |
| 533 int a; |
| 534 }; |
| 535 struct |
| 536 { |
| 537 int b; |
| 538 }; |
| 539 } v = {1, {2}, {3}}; |
| 540 |
| 541 anon = malloc (sizeof (struct anonymous)); |
| 542 anon->a = 1; |
| 543 anon->b = 2; |
| 544 anon->c = (char *) 3; |
| 545 anon->d = 4; |
| 546 anon->g = '5'; |
| 547 anon->h = (const char **) 6; |
| 548 anon->simple = (simpleton ***) 7; |
| 549 |
| 550 ptr = &anon; |
| 551 free (anon); |
| 552 return; /* anonymous type tests breakpoint */ |
| 553 } |
| 554 |
505 int | 555 int |
506 main (int argc, char *argv []) | 556 main (int argc, char *argv []) |
507 { | 557 { |
508 do_locals_tests (); | 558 do_locals_tests (); |
509 do_block_tests (); | 559 do_block_tests (); |
510 do_children_tests (); | 560 do_children_tests (); |
511 do_special_tests (); | 561 do_special_tests (); |
512 do_frozen_tests (); | 562 do_frozen_tests (); |
513 do_at_tests (); | 563 do_at_tests (); |
514 do_bitfield_tests (); | 564 do_bitfield_tests (); |
| 565 do_anonymous_type_tests (); |
515 exit (0); | 566 exit (0); |
516 } | 567 } |
517 | 568 |
518 | 569 |
OLD | NEW |