summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/binutils/gdb/mswin/gdbwrap.cpp
blob: 618b705c0ba008fd268b73642c7e52802bcfc9f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#if 0
#include <stdio.h>

typedef void *CORE_ADDR;
typedef FILE GDB_FILE;
typedef long LONGEST;
#define PARAMS(x) x

extern "C" 
{
#include "tm.h" 
//#include "frame.h"
#include "breakpoint.h"
#include "symtab.h"
#include "gdbtypes.h"
};


#include "gdbwrap.h"

//SYNTAX ERROR

///////////////////////////////////////////////////////////////////////
// symbol wrappers
GdbAddressClass GdbSymbol::GetSymbolClass()
{
  return (GdbAddressClass) (ingdb()->aclass) ;
}

GdbType *GdbSymbol::GetType() 
{
return (GdbType*)(ingdb()->type);
}
char *GdbSymbol::GetName()
{
return ingdb()->ginfo.name;
}

GdbSymbol *GdbSymbol::Lookup(const char *name)
{
#if 0
return (GdbSymbol*)lookup_symbol (p, gename);
#else
return (GdbSymbol*)lookup_symbol (name,get_current_block(), VAR_NAMESPACE, NULL, NULL);
#endif
}
//////////////////////////////////////////////////////////////////////
// frame_info wrappers 

GdbBlock *GdbFrameInfo::GetFrameBlock()
{
  return (GdbBlock *)get_frame_block(ingdb());
}

GdbFrameInfo *GdbFrameInfo::GetCurrentFrame()
{
return (GdbFrameInfo *)(get_current_frame());
}

GdbFrameInfo *GdbFrameInfo::GetPrevFrame()
{
return (GdbFrameInfo *)(get_prev_frame(ingdb()));
}


//////////////////////////////////////////////////////////////////////
// block wrappers

int GdbBlock::GetNSyms()
{
return BLOCK_NSYMS(ingdb());
}

GdbSymbol *GdbBlock::GetBlockSym(int i)
{
  return (GdbSymbol *)(BLOCK_SYM(ingdb(),i));
}
GdbBlock *GdbBlock::GetSuperBlock()
{
  return (GdbBlock *)BLOCK_SUPERBLOCK(ingdb());
}

GdbSymbol *GdbBlock::GetFunction()
{
return (GdbSymbol *)(BLOCK_FUNCTION(ingdb()));
}
//////////////////////////////////////////////////////////////////////
// gdbvalue


GdbValue *GdbValue::ReadVarValue(GdbSymbol *symbol,
	GdbFrameInfo *frame)
{
return (GdbValue *)(read_var_value (symbol->ingdb(), frame->ingdb()));
}

GdbLValType GdbValue::GetLVal()
{
return (GdbLValType)(VALUE_LVAL(ingdb()));
}

int GdbValue::GetAddress()
{
return (int)VALUE_ADDRESS(ingdb());
}
int GdbValue::GetRegno()
{
return VALUE_REGNO(ingdb());
}
int GdbValue::GetFrame()
{
return (int)VALUE_FRAME(ingdb());
}

LONGEST GdbValue::GetInt()
{
return unpack_long (VALUE_TYPE(ingdb()), VALUE_CONTENTS(ingdb()));
}

char *GdbValue::GetEnumName()
{
  struct type *typ =VALUE_TYPE(ingdb());
  int len = TYPE_NFIELDS ( typ);
  int val = unpack_long (typ, VALUE_CONTENTS(ingdb()));
  int i;
  for (i = 0; i < len; i++)
    {
      if (val == TYPE_FIELD_BITPOS (typ, i))
	{
	  return TYPE_FIELD_NAME (typ, i);
	}
    }
  return "*";
}
//////////////////////////////////////////////////////////////////////

GdbTypeCode GdbType::GetTypeCode()
{
return (GdbTypeCode)(ingdb()->code);
}
#endif