2 // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
3 // Copyright (C) 1999-2003 Forgotten
4 // Copyright (C) 2004 Forgotten and the VBA development team
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2, or(at your option)
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software Foundation,
18 // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 typedef enum LocationType
{
32 #define DW_ATE_boolean 0x02
33 #define DW_ATE_signed 0x05
34 #define DW_ATE_unsigned 0x07
35 #define DW_ATE_unsigned_char 0x08
37 typedef struct ELFHeader
{
58 typedef struct ELFProgramHeader
{
69 typedef struct ELFSectionHeader
{
82 typedef struct ELFSymbol
{
91 typedef struct ELFBlock
{
96 typedef struct ELFAttr
{
108 typedef struct ELFAbbrev
{
113 struct ELFAttr
*attrs
;
114 struct ELFAbbrev
*next
;
117 typedef enum TypeEnum
{
132 typedef struct FunctionType
{
133 struct Type
*returnType
;
137 typedef struct Member
{
146 typedef struct Struct
{
151 typedef struct Array
{
157 typedef struct EnumMember
{
162 typedef struct Enum
{
167 typedef struct Type
{
175 struct Type
*pointer
;
176 FunctionType
*function
;
184 typedef struct Object
{
196 typedef struct Function
{
207 struct Function
*next
;
210 typedef struct LineInfoItem
{
216 typedef struct LineInfo
{
223 typedef struct ARange
{
228 typedef struct ARanges
{
234 typedef struct CompileUnit
{
246 LineInfo
*lineInfoTable
;
248 Function
*lastFunction
;
251 struct CompileUnit
*next
;
254 typedef struct DebugInfo
{
263 typedef struct Symbol
{
272 extern u32
elfReadLEB128(u8
*, int *);
273 extern s32
elfReadSignedLEB128(u8
*, int *);
274 extern bool elfRead(const char *, int*, FILE *f
);
275 extern bool elfGetSymbolAddress(char *,u32
*, u32
*, int *);
276 extern char *elfGetAddressSymbol(u32
);
277 extern char *elfGetSymbol(int, u32
*, u32
*, int *);
278 extern void elfCleanUp(void);
279 extern bool elfGetCurrentFunction(u32
, Function
**, CompileUnit
**c
);
280 extern bool elfGetObject(char *, Function
*, CompileUnit
*, Object
**);
281 extern bool elfFindLineInUnit(u32
*, CompileUnit
*, int);
282 extern bool elfFindLineInModule(u32
*, char *, int);
283 u32
elfDecodeLocation(Function
*, ELFBlock
*, LocationType
*);
284 u32
elfDecodeLocation4(Function
*, ELFBlock
*, LocationType
*, u32
);
285 int elfFindLine(CompileUnit
*unit
, Function
*func
, u32 addr
, char **);