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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [20020402-3.c] - Blame information for rev 298

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

Line No. Rev Author Line
1 297 jeremybenn
/* extracted from gdb sources */
2
 
3
typedef unsigned long long CORE_ADDR;
4
 
5
struct blockvector;
6
 
7
struct symtab {
8
  struct blockvector *blockvector;
9
};
10
 
11
struct sec {
12
  void *unused;
13
};
14
 
15
struct symbol {
16
  int len;
17
  char *name;
18
};
19
 
20
struct block {
21
        CORE_ADDR startaddr, endaddr;
22
        struct symbol *function;
23
        struct block *superblock;
24
        unsigned char gcc_compile_flag;
25
        int nsyms;
26
        struct symbol syms[1];
27
};
28
 
29
struct blockvector {
30
        int nblocks;
31
        struct block *block[2];
32
};
33
 
34
struct blockvector *blockvector_for_pc_sect(register CORE_ADDR pc,
35
                                            struct symtab *symtab)
36
{
37
  register struct block *b;
38
  register int bot, top, half;
39
  struct blockvector *bl;
40
 
41
  bl = symtab->blockvector;
42
  b = bl->block[0];
43
 
44
  bot = 0;
45
  top = bl->nblocks;
46
 
47
  while (top - bot > 1)
48
    {
49
      half = (top - bot + 1) >> 1;
50
      b = bl->block[bot + half];
51
      if (b->startaddr <= pc)
52
        bot += half;
53
      else
54
        top = bot + half;
55
    }
56
 
57
  while (bot >= 0)
58
    {
59
      b = bl->block[bot];
60
      if (b->endaddr > pc)
61
        {
62
          return bl;
63
        }
64
      bot--;
65
    }
66
  return 0;
67
}
68
 
69
int main(void)
70
{
71
  struct block a = { 0, 0x10000, 0, 0, 1, 20 };
72
  struct block b = { 0x10000, 0x20000, 0, 0, 1, 20 };
73
  struct blockvector bv = { 2, { &a, &b } };
74
  struct symtab s = { &bv };
75
 
76
  struct blockvector *ret;
77
 
78
  ret = blockvector_for_pc_sect(0x500, &s);
79
 
80
  return 0;
81
}

powered by: WebSVN 2.1.0

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