~ubuntu-branches/ubuntu/karmic/firebird2.1/karmic

« back to all changes in this revision

Viewing changes to src/jrd/DebugInterface.h

  • Committer: Bazaar Package Importer
  • Author(s): Damyan Ivanov
  • Date: 2008-05-26 23:59:25 UTC
  • Revision ID: james.westby@ubuntu.com-20080526235925-2pnqj6nxpppoeaer
Tags: upstream-2.1.0.17798-0.ds2
ImportĀ upstreamĀ versionĀ 2.1.0.17798-0.ds2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  The contents of this file are subject to the Initial
 
3
 *  Developer's Public License Version 1.0 (the "License");
 
4
 *  you may not use this file except in compliance with the
 
5
 *  License. You may obtain a copy of the License at
 
6
 *  http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl.
 
7
 *
 
8
 *  Software distributed under the License is distributed AS IS,
 
9
 *  WITHOUT WARRANTY OF ANY KIND, either express or implied.
 
10
 *  See the License for the specific language governing rights
 
11
 *  and limitations under the License.
 
12
 *
 
13
 *  The Original Code was created by Vlad Horsun
 
14
 *  for the Firebird Open Source RDBMS project.
 
15
 *
 
16
 *  Copyright (c) 2006 Vlad Horsun <hvlad@users.sourceforge.net>
 
17
 *  and all contributors signed below.
 
18
 *
 
19
 *  All Rights Reserved.
 
20
 *  Contributor(s): ______________________________________.
 
21
 */
 
22
 
 
23
#ifndef DEBUG_INTERFACE_H
 
24
#define DEBUG_INTERFACE_H
 
25
 
 
26
#include "firebird.h"
 
27
#include "../jrd/jrd.h"
 
28
 
 
29
#include "../jrd/blb.h"
 
30
 
 
31
namespace Firebird {
 
32
 
 
33
class MapBlrToSrcItem
 
34
{
 
35
public:
 
36
        USHORT mbs_offset;
 
37
        USHORT mbs_src_line;
 
38
        USHORT mbs_src_col;
 
39
 
 
40
        static const USHORT generate(const void*, const MapBlrToSrcItem& Item) 
 
41
        { return Item.mbs_offset; }
 
42
};
 
43
 
 
44
typedef Firebird::SortedArray<
 
45
        MapBlrToSrcItem, 
 
46
        Firebird::EmptyStorage<MapBlrToSrcItem>, 
 
47
        USHORT, 
 
48
        MapBlrToSrcItem> MapBlrToSrc;
 
49
 
 
50
typedef GenericMap<Pair<Right<USHORT, MetaName> > > MapVarIndexToName;
 
51
 
 
52
struct ArgumentInfo
 
53
{
 
54
        ArgumentInfo(UCHAR aType, USHORT aIndex)
 
55
                : type(aType),
 
56
                  index(aIndex)
 
57
        {
 
58
        }
 
59
 
 
60
        ArgumentInfo()
 
61
                : type(0),
 
62
                  index(0)
 
63
        {
 
64
        }
 
65
 
 
66
        UCHAR type;
 
67
        USHORT index;
 
68
 
 
69
        bool operator >(const ArgumentInfo& x) const
 
70
        {
 
71
                if (type == x.type)
 
72
                        return index > x.index;
 
73
 
 
74
                return type > x.type;
 
75
        }
 
76
};
 
77
 
 
78
typedef GenericMap<Pair<Right<ArgumentInfo, MetaName> > > MapArgumentInfoToName;
 
79
 
 
80
struct DbgInfo
 
81
{
 
82
        DbgInfo(MemoryPool& p)
 
83
                : blrToSrc(p),
 
84
                  varIndexToName(p),
 
85
                  argInfoToName(p)
 
86
        {
 
87
        }
 
88
 
 
89
        DbgInfo()
 
90
        {
 
91
        }
 
92
 
 
93
        void clear()
 
94
        {
 
95
                blrToSrc.clear();
 
96
                varIndexToName.clear();
 
97
                argInfoToName.clear();
 
98
        }
 
99
 
 
100
        MapBlrToSrc blrToSrc;                                   // mapping between blr offsets and source text position
 
101
        MapVarIndexToName varIndexToName;               // mapping between variable index and name
 
102
        MapArgumentInfoToName argInfoToName;    // mapping between argument info (type, index) and name
 
103
};
 
104
 
 
105
} // namespace Firebird 
 
106
 
 
107
void DBG_parse_debug_info(Jrd::thread_db*, Jrd::bid*, Firebird::DbgInfo&);
 
108
void DBG_parse_debug_info(USHORT, const UCHAR*, Firebird::DbgInfo&);
 
109
 
 
110
#endif // DEBUG_INTERFACE_H