GEL  0.99
debug_line.h
Go to the documentation of this file.
1 /*
2  * $Id$
3  * Copyright (c) 2011, IRIT- UPS
4  *
5  * GEL is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * GEL is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with GEL; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 #ifndef GEL_DEBUG_LINE_H
20 #define GEL_DEBUG_LINE_H
21 
22 #include <stdint.h>
23 #include <gel/common.h>
24 #include <gel/util.h>
25 #include <gel/gel.h>
26 
28 
29 /* flags */
30 #define GEL_IS_STMT 0x0001
31 #define GEL_BASIC_BLOCK 0x0002
32 #define GEL_PROLOGUE_END 0x0004
33 #define GEL_EPILOGUE_BEGIN 0x0008
34 #define GEL_END_SEQUENCE 0x8000
35 
36 /* gel_line_map_t type */
37 typedef struct gel_line_map_t gel_line_map_t;
38 typedef struct unit_t gel_unit_t;
39 
40 /* gel_line_iter_t type */
41 typedef struct gel_line_iter_t {
43  struct unit_t *unit;
44  int line, loc;
47 
48 /* gel_addr_iter_t type */
49 typedef struct gel_addr_iter_t {
51  struct segment_t *seg;
52  int loc;
54 
55 /* gel_location_t type */
56 typedef struct gel_location_t {
57  const char *file;
58  uint32_t line;
60  uint16_t flags;
61  uint16_t isa;
63 
64 /* unit iterator */
65 typedef struct gel_unit_iter_t {
67  struct unit_t *unit;
70 
71 /* management */
74 int gel_line_from_address(gel_line_map_t *map, vaddr_t addr, const char **file, int *line);
75 vaddr_t gel_address_from_line(gel_line_map_t *map, const char *file, int line);
76 
77 /* unit accessor */
80 const char *gel_unit_name(gel_unit_t *unit);
82 
83 /* location accessor */
84 #define gel_isa(l) (l.isa)
85 #define gel_is_stmt(l) (l.flags & GEL_IS_STMT)
86 #define gel_basic_block(l) (l.flags & GEL_BASIC_BLOCK)
87 #define gel_prologue_end(l) (l.flags & GEL_PROLOGUE_END)
88 #define gel_epilogue_begin(l) (l.flags & GEL_EPILOGUE_BEGIN)
89 
90 /* Iterators */
95 
97 
98 #endif /* GEL_DEBUG_LINE_H */
#define __END_DECLS
Definition: common.h:29
#define __BEGIN_DECLS
Definition: common.h:28
struct gel_unit_iter_t gel_unit_iter_t
gel_unit_t * gel_unit_first(gel_line_map_t *map, gel_unit_iter_t *iter)
Definition: debug_line.c:231
gel_unit_t * gel_unit_next(gel_unit_iter_t *iter)
Definition: debug_line.c:243
const char * gel_unit_name(gel_unit_t *unit)
Definition: debug_line.c:254
gel_location_t gel_unit_to_line_iter(gel_unit_iter_t *unit, gel_line_iter_t *line)
Definition: debug_line.c:265
struct gel_addr_iter_t gel_addr_iter_t
struct gel_line_iter_t gel_line_iter_t
int gel_line_from_address(gel_line_map_t *map, vaddr_t addr, const char **file, int *line)
Definition: debug_line.c:387
gel_location_t gel_first_line(gel_line_iter_t *iter, gel_line_map_t *map)
Definition: debug_line.c:200
vaddr_t gel_address_from_line(gel_line_map_t *map, const char *file, int line)
Definition: debug_line.c:355
struct gel_location_t gel_location_t
void gel_delete_line_map(gel_line_map_t *map)
Definition: debug_line.c:104
gel_location_t gel_next_line(gel_line_iter_t *iter)
Definition: debug_line.c:220
gel_location_t gel_first_addr(gel_addr_iter_t *iter, gel_line_map_t *map)
Definition: debug_line.c:324
gel_location_t gel_next_addr(gel_addr_iter_t *iter)
Definition: debug_line.c:341
gel_line_map_t * gel_new_line_map(gel_file_t *file)
Definition: debug_line.c:476
Definition: debug_line.h:49
struct segment_t * seg
Definition: debug_line.h:51
int loc
Definition: debug_line.h:52
gel_line_map_t * map
Definition: debug_line.h:50
Definition: file.h:31
Definition: util.h:108
Definition: debug_line.h:41
int loc
Definition: debug_line.h:44
struct unit_t * unit
Definition: debug_line.h:43
gel_line_map_t * map
Definition: debug_line.h:45
int line
Definition: debug_line.h:44
gel_hash_enum_t hen
Definition: debug_line.h:42
Definition: debug.h:67
Definition: debug_line.h:56
uint16_t isa
Definition: debug_line.h:61
uint32_t line
Definition: debug_line.h:58
uint16_t flags
Definition: debug_line.h:60
const char * file
Definition: debug_line.h:57
vaddr_t high_addr
Definition: debug_line.h:59
vaddr_t low_addr
Definition: debug_line.h:59
Definition: debug_line.h:65
struct unit_t * unit
Definition: debug_line.h:67
gel_line_map_t * map
Definition: debug_line.h:68
gel_hash_enum_t hen
Definition: debug_line.h:66
Definition: debug.h:59
Definition: debug.h:50
uint32_t vaddr_t
Definition: types.h:36