OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [testsuite/] [gdb.base/] [nodebug.c] - Diff between revs 107 and 1765

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 107 Rev 1765
#include <stdlib.h>
#include <stdlib.h>
/* Test that things still (sort of) work when compiled without -g.  */
/* Test that things still (sort of) work when compiled without -g.  */
 
 
int dataglobal = 3;                     /* Should go in global data */
int dataglobal = 3;                     /* Should go in global data */
static int datalocal = 4;               /* Should go in local data */
static int datalocal = 4;               /* Should go in local data */
int bssglobal;                          /* Should go in global bss */
int bssglobal;                          /* Should go in global bss */
static int bsslocal;                    /* Should go in local bss */
static int bsslocal;                    /* Should go in local bss */
 
 
#ifdef PROTOTYPES
#ifdef PROTOTYPES
int
int
inner (int x)
inner (int x)
#else
#else
int
int
inner (x)
inner (x)
     int x;
     int x;
#endif
#endif
{
{
  return x + dataglobal + datalocal + bssglobal + bsslocal;
  return x + dataglobal + datalocal + bssglobal + bsslocal;
}
}
 
 
#ifdef PROTOTYPES
#ifdef PROTOTYPES
static short
static short
middle (int x)
middle (int x)
#else
#else
static short
static short
middle (x)
middle (x)
     int x;
     int x;
#endif
#endif
{
{
  return 2 * inner (x);
  return 2 * inner (x);
}
}
 
 
#ifdef PROTOTYPES
#ifdef PROTOTYPES
short
short
top (int x)
top (int x)
#else
#else
short
short
top (x)
top (x)
     int x;
     int x;
#endif
#endif
{
{
  return 2 * middle (x);
  return 2 * middle (x);
}
}
 
 
#ifdef PROTOTYPES
#ifdef PROTOTYPES
int
int
main (int argc, char **argv)
main (int argc, char **argv)
#else
#else
int
int
main (argc, argv)
main (argc, argv)
     int argc;
     int argc;
     char **argv;
     char **argv;
#endif
#endif
{
{
#ifdef usestubs
#ifdef usestubs
  set_debug_traps();
  set_debug_traps();
  breakpoint();
  breakpoint();
#endif
#endif
  return top (argc);
  return top (argc);
}
}
 
 
int *x;
int *x;
 
 
#ifdef PROTOTYPES
#ifdef PROTOTYPES
int array_index (char *arr, int i)
int array_index (char *arr, int i)
#else
#else
int
int
array_index (arr, i)
array_index (arr, i)
     char *arr;
     char *arr;
     int i;
     int i;
#endif
#endif
{
{
  /* The basic concept is just "return arr[i];".  But call malloc so that gdb
  /* The basic concept is just "return arr[i];".  But call malloc so that gdb
     will be able to call functions.  */
     will be able to call functions.  */
  char retval;
  char retval;
  x = (int *) malloc (sizeof (int));
  x = (int *) malloc (sizeof (int));
  *x = i;
  *x = i;
  retval = arr[*x];
  retval = arr[*x];
  free (x);
  free (x);
  return retval;
  return retval;
}
}
 
 

powered by: WebSVN 2.1.0

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