OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gdb/] [gdb-6.8/] [gdb-6.8.openrisc-2.1/] [gdb/] [testsuite/] [gdb.mi/] [mi-var-child.c] - Diff between revs 24 and 33

Only display areas with differences | Details | Blame | View Log

Rev 24 Rev 33
/* Copyright 1999, 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
/* Copyright 1999, 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
 
 
   This file is part of GDB.
   This file is part of GDB.
 
 
   This program is free software; you can redistribute it and/or modify
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 3 of the License, or
   the Free Software Foundation; either version 3 of the License, or
   (at your option) any later version.
   (at your option) any later version.
 
 
   This program is distributed in the hope that it will be useful,
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   GNU General Public License for more details.
 
 
   You should have received a copy of the GNU General Public License
   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 
#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
#include <string.h>
 
 
struct _simple_struct {
struct _simple_struct {
  int integer;
  int integer;
  unsigned int unsigned_integer;
  unsigned int unsigned_integer;
  char character;
  char character;
  signed char signed_character;
  signed char signed_character;
  char *char_ptr;
  char *char_ptr;
  int array_of_10[10];
  int array_of_10[10];
};
};
 
 
typedef struct _simple_struct simpleton;
typedef struct _simple_struct simpleton;
 
 
simpleton global_simple;
simpleton global_simple;
 
 
enum foo {
enum foo {
  bar = 1,
  bar = 1,
  baz
  baz
};
};
 
 
typedef enum foo efoo;
typedef enum foo efoo;
 
 
union named_union
union named_union
{
{
  int integer;
  int integer;
  char *char_ptr;
  char *char_ptr;
};
};
 
 
typedef struct _struct_decl {
typedef struct _struct_decl {
  int   integer;
  int   integer;
  char  character;
  char  character;
  char *char_ptr;
  char *char_ptr;
  long  long_int;
  long  long_int;
  int  **int_ptr_ptr;
  int  **int_ptr_ptr;
  long  long_array[12];
  long  long_array[12];
 
 
  void (*func_ptr) (void);
  void (*func_ptr) (void);
  struct _struct_decl (*func_ptr_struct) (int, char *, long);
  struct _struct_decl (*func_ptr_struct) (int, char *, long);
  struct _struct_decl *(*func_ptr_ptr) (int, char *, long);
  struct _struct_decl *(*func_ptr_ptr) (int, char *, long);
  union {
  union {
    int   a;
    int   a;
    char *b;
    char *b;
    long  c;
    long  c;
    enum foo d;
    enum foo d;
  } u1;
  } u1;
 
 
  struct {
  struct {
    union {
    union {
      struct {
      struct {
        int d;
        int d;
        char e[10];
        char e[10];
        int *(*func) (void);
        int *(*func) (void);
        efoo foo;
        efoo foo;
      } u1s1;
      } u1s1;
 
 
      long f;
      long f;
      struct {
      struct {
        char array_ptr[2];
        char array_ptr[2];
        int (*func) (int, char *);
        int (*func) (int, char *);
      } u1s2;
      } u1s2;
    } u2;
    } u2;
 
 
    int g;
    int g;
    char h;
    char h;
    long i[10];
    long i[10];
  } s2;
  } s2;
} weird_struct;
} weird_struct;
 
 
struct _struct_n_pointer {
struct _struct_n_pointer {
  char ****char_ptr;
  char ****char_ptr;
  long ****long_ptr;
  long ****long_ptr;
  struct _struct_n_pointer *ptrs[3];
  struct _struct_n_pointer *ptrs[3];
  struct _struct_n_pointer *next;
  struct _struct_n_pointer *next;
};
};
 
 
void do_locals_tests (void);
void do_locals_tests (void);
void do_block_tests (void);
void do_block_tests (void);
void subroutine1 (int, long *);
void subroutine1 (int, long *);
void nothing (void);
void nothing (void);
void do_children_tests (void);
void do_children_tests (void);
void do_special_tests (void);
void do_special_tests (void);
void incr_a (char);
void incr_a (char);
 
 
void incr_a (char a)
void incr_a (char a)
{
{
  int b;
  int b;
  b = a;
  b = a;
}
}
 
 
void
void
do_locals_tests ()
do_locals_tests ()
{
{
  int linteger;
  int linteger;
  int *lpinteger;
  int *lpinteger;
  char lcharacter;
  char lcharacter;
  char *lpcharacter;
  char *lpcharacter;
  long llong;
  long llong;
  long *lplong;
  long *lplong;
  float lfloat;
  float lfloat;
  float *lpfloat;
  float *lpfloat;
  double ldouble;
  double ldouble;
  double *lpdouble;
  double *lpdouble;
  struct _simple_struct lsimple;
  struct _simple_struct lsimple;
  struct _simple_struct *lpsimple;
  struct _simple_struct *lpsimple;
  void (*func) (void);
  void (*func) (void);
 
 
  /* Simple assignments */
  /* Simple assignments */
  linteger = 1234;
  linteger = 1234;
  lpinteger = &linteger;
  lpinteger = &linteger;
  lcharacter = 'a';
  lcharacter = 'a';
  lpcharacter = &lcharacter;
  lpcharacter = &lcharacter;
  llong = 2121L;
  llong = 2121L;
  lplong = &llong;
  lplong = &llong;
  lfloat = 2.1;
  lfloat = 2.1;
  lpfloat = &lfloat;
  lpfloat = &lfloat;
  ldouble = 2.718281828459045;
  ldouble = 2.718281828459045;
  lpdouble = &ldouble;
  lpdouble = &ldouble;
  lsimple.integer = 1234;
  lsimple.integer = 1234;
  lsimple.unsigned_integer = 255;
  lsimple.unsigned_integer = 255;
  lsimple.character = 'a';
  lsimple.character = 'a';
  lsimple.signed_character = 21;
  lsimple.signed_character = 21;
  lsimple.char_ptr = &lcharacter;
  lsimple.char_ptr = &lcharacter;
  lpsimple = &lsimple;
  lpsimple = &lsimple;
  func = nothing;
  func = nothing;
 
 
  /* Check pointers */
  /* Check pointers */
  linteger = 4321;
  linteger = 4321;
  lcharacter = 'b';
  lcharacter = 'b';
  llong = 1212L;
  llong = 1212L;
  lfloat = 1.2;
  lfloat = 1.2;
  ldouble = 5.498548281828172;
  ldouble = 5.498548281828172;
  lsimple.integer = 255;
  lsimple.integer = 255;
  lsimple.unsigned_integer = 4321;
  lsimple.unsigned_integer = 4321;
  lsimple.character = 'b';
  lsimple.character = 'b';
  lsimple.signed_character = 0;
  lsimple.signed_character = 0;
 
 
  subroutine1 (linteger, &llong);
  subroutine1 (linteger, &llong);
}
}
 
 
void
void
nothing ()
nothing ()
{
{
}
}
 
 
void
void
subroutine1 (int i, long *l)
subroutine1 (int i, long *l)
{
{
  global_simple.integer = i + 3;
  global_simple.integer = i + 3;
  i = 212;
  i = 212;
  *l = 12;
  *l = 12;
}
}
 
 
void
void
do_block_tests ()
do_block_tests ()
{
{
  int cb = 12;
  int cb = 12;
 
 
  {
  {
    int foo;
    int foo;
    foo = 123;
    foo = 123;
    {
    {
      int foo2;
      int foo2;
      foo2 = 123;
      foo2 = 123;
      {
      {
        int foo;
        int foo;
        foo = 321;
        foo = 321;
      }
      }
      foo2 = 0;
      foo2 = 0;
    }
    }
    foo = 0;
    foo = 0;
  }
  }
 
 
  cb = 21;
  cb = 21;
}
}
 
 
void
void
do_children_tests (void)
do_children_tests (void)
{
{
  weird_struct *weird;
  weird_struct *weird;
  struct _struct_n_pointer *psnp;
  struct _struct_n_pointer *psnp;
  struct _struct_n_pointer snp0, snp1, snp2;
  struct _struct_n_pointer snp0, snp1, snp2;
  char a0[2] = {}, *a1, **a2, ***a3;
  char a0[2] = {}, *a1, **a2, ***a3;
  char b0[2] = {}, *b1, **b2, ***b3;
  char b0[2] = {}, *b1, **b2, ***b3;
  char c0[2] = {}, *c1, **c2, ***c3;
  char c0[2] = {}, *c1, **c2, ***c3;
  long z0, *z1, **z2, ***z3;
  long z0, *z1, **z2, ***z3;
  long y0, *y1, **y2, ***y3;
  long y0, *y1, **y2, ***y3;
  long x0, *x1, **x2, ***x3;
  long x0, *x1, **x2, ***x3;
  int *foo;
  int *foo;
  int bar;
  int bar;
 
 
  /* Avoid pointing into NULL, as that is editable on some
  /* Avoid pointing into NULL, as that is editable on some
     systems.  */
     systems.  */
  int dummy;
  int dummy;
  int *dummy_ptr = &dummy;
  int *dummy_ptr = &dummy;
 
 
  struct _struct_decl struct_declarations = { 0, 0, NULL, 0, &dummy_ptr };
  struct _struct_decl struct_declarations = { 0, 0, NULL, 0, &dummy_ptr };
  weird = &struct_declarations;
  weird = &struct_declarations;
 
 
  struct_declarations.integer = 123;
  struct_declarations.integer = 123;
  weird->char_ptr = "hello";
  weird->char_ptr = "hello";
  bar = 2121;
  bar = 2121;
  foo = &bar;
  foo = &bar;
  struct_declarations.int_ptr_ptr = &foo;
  struct_declarations.int_ptr_ptr = &foo;
  weird->long_array[0] = 1234;
  weird->long_array[0] = 1234;
  struct_declarations.long_array[1] = 2345;
  struct_declarations.long_array[1] = 2345;
  weird->long_array[2] = 3456;
  weird->long_array[2] = 3456;
  struct_declarations.long_array[3] = 4567;
  struct_declarations.long_array[3] = 4567;
  weird->long_array[4] = 5678;
  weird->long_array[4] = 5678;
  struct_declarations.long_array[5] = 6789;
  struct_declarations.long_array[5] = 6789;
  weird->long_array[6] = 7890;
  weird->long_array[6] = 7890;
  struct_declarations.long_array[7] = 8901;
  struct_declarations.long_array[7] = 8901;
  weird->long_array[8] = 9012;
  weird->long_array[8] = 9012;
  struct_declarations.long_array[9] = 1234;
  struct_declarations.long_array[9] = 1234;
 
 
  weird->func_ptr = nothing;
  weird->func_ptr = nothing;
  struct_declarations.long_array[10] = 3456;
  struct_declarations.long_array[10] = 3456;
  struct_declarations.long_array[11] = 5678;
  struct_declarations.long_array[11] = 5678;
 
 
  /* Struct/pointer/array tests */
  /* Struct/pointer/array tests */
  a0[0] = '0';
  a0[0] = '0';
  a1 = a0;
  a1 = a0;
  a2 = &a1;
  a2 = &a1;
  a3 = &a2;
  a3 = &a2;
  b0[0] = '1';
  b0[0] = '1';
  b1 = b0;
  b1 = b0;
  b2 = &b1;
  b2 = &b1;
  b3 = &b2;
  b3 = &b2;
  c0[1] = '2';
  c0[1] = '2';
  c1 = c0;
  c1 = c0;
  c2 = &c1;
  c2 = &c1;
  c3 = &c2;
  c3 = &c2;
  z0 = 0xdead + 0;
  z0 = 0xdead + 0;
  z1 = &z0;
  z1 = &z0;
  z2 = &z1;
  z2 = &z1;
  z3 = &z2;
  z3 = &z2;
  y0 = 0xdead + 1;
  y0 = 0xdead + 1;
  y1 = &y0;
  y1 = &y0;
  y2 = &y1;
  y2 = &y1;
  y3 = &y2;
  y3 = &y2;
  x0 = 0xdead + 2;
  x0 = 0xdead + 2;
  x1 = &x0;
  x1 = &x0;
  x2 = &x1;
  x2 = &x1;
  x3 = &x2;
  x3 = &x2;
  snp0.char_ptr = &a3;
  snp0.char_ptr = &a3;
  snp0.long_ptr = &z3;
  snp0.long_ptr = &z3;
  snp0.ptrs[0] = &snp0;
  snp0.ptrs[0] = &snp0;
  snp0.ptrs[1] = &snp1;
  snp0.ptrs[1] = &snp1;
  snp0.ptrs[2] = &snp2;
  snp0.ptrs[2] = &snp2;
  snp0.next = &snp1;
  snp0.next = &snp1;
  snp1.char_ptr = &b3;
  snp1.char_ptr = &b3;
  snp1.long_ptr = &y3;
  snp1.long_ptr = &y3;
  snp1.ptrs[0] = &snp0;
  snp1.ptrs[0] = &snp0;
  snp1.ptrs[1] = &snp1;
  snp1.ptrs[1] = &snp1;
  snp1.ptrs[2] = &snp2;
  snp1.ptrs[2] = &snp2;
  snp1.next = &snp2;
  snp1.next = &snp2;
  snp2.char_ptr = &c3;
  snp2.char_ptr = &c3;
  snp2.long_ptr = &x3;
  snp2.long_ptr = &x3;
  snp2.ptrs[0] = &snp0;
  snp2.ptrs[0] = &snp0;
  snp2.ptrs[1] = &snp1;
  snp2.ptrs[1] = &snp1;
  snp2.ptrs[2] = &snp2;
  snp2.ptrs[2] = &snp2;
  snp2.next = 0x0;
  snp2.next = 0x0;
  psnp = &snp0;
  psnp = &snp0;
  snp0.char_ptr = &b3;
  snp0.char_ptr = &b3;
  snp1.char_ptr = &c3;
  snp1.char_ptr = &c3;
  snp2.char_ptr = &a3;
  snp2.char_ptr = &a3;
  snp0.long_ptr = &y3;
  snp0.long_ptr = &y3;
  snp1.long_ptr = &x3;
  snp1.long_ptr = &x3;
  snp2.long_ptr = &z3;
  snp2.long_ptr = &z3;
}
}
 
 
void
void
do_special_tests (void)
do_special_tests (void)
{
{
  union named_union u;
  union named_union u;
  union {
  union {
    int a;
    int a;
    char b;
    char b;
    long c;
    long c;
  } anonu;
  } anonu;
  struct _simple_struct s;
  struct _simple_struct s;
  struct {
  struct {
    int a;
    int a;
    char b;
    char b;
    long c;
    long c;
  } anons;
  } anons;
  enum foo e;
  enum foo e;
  enum { A, B, C } anone;
  enum { A, B, C } anone;
  int array[21];
  int array[21];
  int a;
  int a;
 
 
  a = 1;
  a = 1;
  incr_a(2);
  incr_a(2);
}
}
 
 
struct very_simple_struct
struct very_simple_struct
{
{
  int a;
  int a;
  int b;
  int b;
};
};
 
 
int
int
do_child_deletion (void)
do_child_deletion (void)
{
{
  /*: BEGIN: child_deletion :*/
  /*: BEGIN: child_deletion :*/
  struct very_simple_struct s = {1, 2};
  struct very_simple_struct s = {1, 2};
  /*:
  /*:
    mi_create_varobj S s "create varobj for s"
    mi_create_varobj S s "create varobj for s"
    mi_list_varobj_children S {{S.a a 0 int} {S.b b 0 int}}     \
    mi_list_varobj_children S {{S.a a 0 int} {S.b b 0 int}}     \
       "list children of S"
       "list children of S"
    mi_delete_varobj S.a "delete S.a"
    mi_delete_varobj S.a "delete S.a"
    mi_delete_varobj S.b "delete S.b"
    mi_delete_varobj S.b "delete S.b"
    mi_delete_varobj S "delete S"
    mi_delete_varobj S "delete S"
    :*/
    :*/
  return 99;
  return 99;
  /*: END: child_deletion :*/
  /*: END: child_deletion :*/
}
}
 
 
int
int
main (int argc, char *argv [])
main (int argc, char *argv [])
{
{
  do_locals_tests ();
  do_locals_tests ();
  do_block_tests ();
  do_block_tests ();
  do_children_tests ();
  do_children_tests ();
  do_special_tests ();
  do_special_tests ();
  do_child_deletion ();
  do_child_deletion ();
  exit (0);
  exit (0);
}
}
 
 
 
 
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.