7 Copyright (C) 2009, Nicolas VIVIEN
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU General Public License in the COPYING file at the
19 root directory of this project for more details.
22 #ifndef __BARRYJDG_CODINFO_H__
23 #define __BARRYJDG_CODINFO_H__
31 #define COD_DEBUG_APPNAME_HEADERFIELD 0x0
32 #define COD_DEBUG_UNIQUEID_HEADERFIELD 0x8
34 #define COD_DEBUG_NONE_FIELD 0x0
35 #define COD_DEBUG_BOOLEAN_FIELD 0x1
36 #define COD_DEBUG_BYTE_FIELD 0x2
37 #define COD_DEBUG_CHAR_FIELD 0x3
38 #define COD_DEBUG_SHORT_FIELD 0x4
39 #define COD_DEBUG_INT_FIELD 0x5
40 #define COD_DEBUG_LONG_FIELD 0x6
41 #define COD_DEBUG_CLASS_FIELD 0x7
42 #define COD_DEBUG_ARRAY_FIELD 0x8
43 #define COD_DEBUG_VOID_FIELD 0xA
44 #define COD_DEBUG_DOUBLE_FIELD 0xC
52 class JDGDebugFileList
;
53 class JDGDebugFileEntry
;
58 class JDGDebugFileList
: public std::vector
<JDGDebugFileEntry
> {
60 void AddElement(uint32_t uniqueid
, std::string appname
, std::string filename
);
61 void Dump(std::ostream
&os
) const;
63 inline std::ostream
& operator<<(std::ostream
&os
, const JDGDebugFileList
&list
) {
69 class JDGDebugFileEntry
{
77 void Dump(std::ostream
&os
) const;
83 class JDGClassList
: public std::vector
<JDGClassEntry
> {
87 void createDefaultEntries();
100 // Read from the ".debug" file
101 std::string className
;
102 std::string classPath
;
103 std::string sourceFile
;
114 std::string
getFullClassName() { return classPath
+ "." + className
; };
128 JDGClassList classList
;
130 bool loadDebugFile(const char *filename
);
132 void parseHeaderSection(std::ifstream
&input
);
133 void parseTypeSection(std::ifstream
&input
);
135 uint32_t getUniqueId();
136 std::string
getAppName();
139 uint32_t parseNextHeaderField(std::ifstream
&input
);
140 uint32_t parseNextTypeField(std::ifstream
&input
);
142 void parseAppName(std::ifstream
&input
);
143 void parseUniqueId(std::ifstream
&input
);
145 void parseBoolean(std::ifstream
&input
);
146 void parseByte(std::ifstream
&input
);
147 void parseChar(std::ifstream
&input
);
148 void parseShort(std::ifstream
&input
);
149 void parseInt(std::ifstream
&input
);
150 void parseLong(std::ifstream
&input
);
151 void parseClass(std::ifstream
&input
);
152 void parseArray(std::ifstream
&input
);
153 void parseVoid(std::ifstream
&input
);
154 void parseDouble(std::ifstream
&input
);
158 void searchDebugFile(JDGDebugFileList
&list
);
159 bool loadDebugInfo(JDGDebugFileList
&list
, const char *filename
, JDGCodInfo
&info
);
160 bool loadDebugInfo(JDGDebugFileList
&list
, const uint32_t uniqueId
, const std::string module
, JDGCodInfo
&info
);