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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-7.1/] [gdb/] [testsuite/] [gdb.base/] [display.c] - Blame information for rev 231

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 227 jeremybenn
/* Loop and vars for tests of display commands
2
*/
3
#include <stdio.h>
4
#define LOOP 10
5
 
6
int sum = 0;
7
 
8
/* Call to force a variable onto the stack so we can see its address.  */
9
void force_mem (int *arg) { }
10
 
11
int do_loops()
12
{
13
    int i=0;
14
    int k=0;
15
    int j=0;
16
    float f=3.1415;
17
    for( i = 0; i < LOOP; i++ ) { /* set breakpoint 1 here */
18
        for( j = 0; j < LOOP; j++ ) {
19
            for( k = 0; k < LOOP; k++ ) {
20
                sum++; f++; force_mem (&k);
21
            }
22
        }
23
    }
24
    return i; /* set breakpoint 2 here */
25
}
26
 
27
int do_vars()
28
{
29
    int       j;
30
    int       i = 9;
31
    float     f = 1.234;
32
    char      c = 'Q';
33
    int    *p_i = &i;
34
    float  *p_f = &f;
35
    char   *p_c = "rubarb and fries";
36
 
37
    /* Need some code here to set breaks on.
38
     */
39
    for( j = 0; j < LOOP; j++ ) {
40
        if( p_c[j] == c ) { /* set breakpoint 3 here */
41
            j++;
42
        }
43
        else {
44
            i++;
45
        }
46
    }
47
 
48
    return *p_i;
49
}
50
 
51
main()
52
{
53
    do_loops();
54
    do_vars();
55
}

powered by: WebSVN 2.1.0

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