2 * Copyright (C) 2002-2007, The Perl Foundation
11 * Parrot debugger header files
13 * Initial version by Daniel Grunblatt on 2002.5.19
18 #ifndef PARROT_PDB_H_GUARD
19 #define PARROT_PDB_H_GUARD
23 PDB_SRC_LOADED
= 1 << 1,
26 PDB_BREAK
= 1 << 4, /* Set only from debug_break */
31 PDB_cond_int
= 1 << 0,
32 PDB_cond_num
= 1 << 1,
33 PDB_cond_str
= 1 << 2,
34 PDB_cond_pmc
= 1 << 3,
41 PDB_cond_const
= 1 << 10
45 * Conditions for breakpoint or watchpoints.
47 * type: The type of condition and the way to use arguments.
48 * reg: The register involved, there must be at least one.
49 * value: A pointer to the second argument.
50 * next: A pointer to the next condition - used to construct a
51 * list of watchpoints; not used for conditional breakpoints
54 typedef struct PDB_condition
*PDB_condition_ptr
;
56 typedef struct PDB_condition
{
59 unsigned char dummy
; /* For alignment XXX ?? */
60 void *value
; /* What neeeds to be aligned with what? */
61 PDB_condition_ptr next
;
65 * A label in the source file.
67 * opcode: The pointer to the bytecode where the label is.
68 * number: Number label.
69 * next: The next label.
72 typedef struct PDB_label
*PDB_label_ptr
;
74 typedef struct PDB_label
{
75 const opcode_t
*opcode
;
81 * A line in the source file.
83 * opcode: A pointer to the opcode in the bytecode corresponding to
85 * source_offset: Offset from the source file start.
86 * number: Line number.
87 * label: The label if any.
88 * next: The next line (if any).
90 typedef struct PDB_line
*PDB_line_ptr
;
92 typedef struct PDB_line
{
94 ptrdiff_t source_offset
;
101 * A source code file.
103 * sourcefilename: The source code file name.
104 * source: The file itself.
105 * size: The size of the file in bytes.
106 * list_line: The next line to list.
107 * line: The first line of the source code.
108 * label: The first label.
109 * next: The next file (if any); multiple files are not currently
112 typedef struct PDB_file
*PDB_file_ptr
;
114 typedef struct PDB_file
{
115 char *sourcefilename
;
118 unsigned long list_line
;
125 * List of breakpoints.
127 * pc: Where the breakpoint is
128 * id: The identification number of this breakpoint
129 * skip: The number of times to skip this breakpoint
130 * condition: The condition attached to the breakpoint; may be NULL
131 * prev, next: The previous & next breakpoints in the list; may be NULL.
134 typedef struct PDB_breakpoint
*PDB_breakpoint_ptr
;
136 typedef struct PDB_breakpoint
{
140 PDB_condition_t
*condition
;
141 PDB_breakpoint_ptr prev
;
142 PDB_breakpoint_ptr next
;
148 * file: Source code file.
149 * breakpoint: The first breakpoint.
150 * watchpoint: The first watchpoint
151 * breakpoint_skip: Number of breakpoints to skip.
152 * cur_command: The command being executed.
153 * last_command: Last command executed.
154 * cur_opcode: Current opcode.
155 * state: The status of the program being debugged.
156 * debugee: The interpreter we are debugging
161 PDB_breakpoint_t
*breakpoint
;
162 PDB_condition_t
*watchpoint
;
163 long breakpoint_skip
;
166 opcode_t
*cur_opcode
;
172 /* HEADERIZER BEGIN: src/debug.c */
173 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
176 void Parrot_debugger_break(PARROT_INTERP
, ARGIN(opcode_t
* cur_opcode
))
177 __attribute__nonnull__(1)
178 __attribute__nonnull__(2);
181 void Parrot_debugger_init(PARROT_INTERP
)
182 __attribute__nonnull__(1);
185 void Parrot_debugger_load(PARROT_INTERP
, ARGIN_NULLOK(STRING
*filename
))
186 __attribute__nonnull__(1);
189 ARGMOD(PDB_file_t
*file
),
190 ARGIN(const opcode_t
*cur_opcode
),
192 __attribute__nonnull__(1)
193 __attribute__nonnull__(2)
194 FUNC_MODIFIES(*file
);
196 void PDB_backtrace(PARROT_INTERP
)
197 __attribute__nonnull__(1);
199 PARROT_WARN_UNUSED_RESULT
200 char PDB_break(PARROT_INTERP
)
201 __attribute__nonnull__(1);
203 PARROT_WARN_UNUSED_RESULT
204 char PDB_check_condition(PARROT_INTERP
,
205 ARGIN(const PDB_condition_t
*condition
))
206 __attribute__nonnull__(1)
207 __attribute__nonnull__(2);
209 PARROT_CAN_RETURN_NULL
210 opcode_t
* PDB_compile(PARROT_INTERP
, ARGIN(const char *command
))
211 __attribute__nonnull__(1)
212 __attribute__nonnull__(2);
214 PARROT_CAN_RETURN_NULL
215 PDB_condition_t
* PDB_cond(PARROT_INTERP
, ARGIN(const char *command
))
216 __attribute__nonnull__(1)
217 __attribute__nonnull__(2);
219 void PDB_continue(PARROT_INTERP
, ARGIN_NULLOK(const char *command
))
220 __attribute__nonnull__(1);
222 void PDB_delete_breakpoint(PARROT_INTERP
, ARGIN(const char *command
))
223 __attribute__nonnull__(1)
224 __attribute__nonnull__(2);
226 void PDB_delete_condition(SHIM_INTERP
, ARGMOD(PDB_breakpoint_t
*breakpoint
))
227 __attribute__nonnull__(2)
228 FUNC_MODIFIES(*breakpoint
);
230 void PDB_disable_breakpoint(PARROT_INTERP
, ARGIN(const char *command
))
231 __attribute__nonnull__(1)
232 __attribute__nonnull__(2);
234 void PDB_disassemble(PARROT_INTERP
, SHIM(const char *command
))
235 __attribute__nonnull__(1);
237 size_t PDB_disassemble_op(PARROT_INTERP
,
240 ARGIN(const op_info_t
*info
),
241 ARGIN(const opcode_t
*op
),
242 ARGMOD_NULLOK(PDB_file_t
*file
),
243 ARGIN_NULLOK(const opcode_t
*code_start
),
245 __attribute__nonnull__(1)
246 __attribute__nonnull__(2)
247 __attribute__nonnull__(4)
248 __attribute__nonnull__(5)
249 FUNC_MODIFIES(*dest
);
251 void PDB_enable_breakpoint(PARROT_INTERP
, ARGIN(const char *command
))
252 __attribute__nonnull__(1)
253 __attribute__nonnull__(2);
255 PARROT_WARN_UNUSED_RESULT
256 PARROT_CAN_RETURN_NULL
258 char * PDB_escape(ARGIN(const char *string
), INTVAL length
)
259 __attribute__nonnull__(1);
261 void PDB_eval(PARROT_INTERP
, ARGIN(const char *command
))
262 __attribute__nonnull__(1)
263 __attribute__nonnull__(2);
265 PARROT_CAN_RETURN_NULL
266 PARROT_WARN_UNUSED_RESULT
267 PDB_breakpoint_t
* PDB_find_breakpoint(PARROT_INTERP
,
268 ARGIN(const char *command
))
269 __attribute__nonnull__(1)
270 __attribute__nonnull__(2);
272 void PDB_free_file(PARROT_INTERP
)
273 __attribute__nonnull__(1);
275 void PDB_get_command(PARROT_INTERP
)
276 __attribute__nonnull__(1);
278 PARROT_WARN_UNUSED_RESULT
280 char PDB_hasinstruction(ARGIN(const char *c
))
281 __attribute__nonnull__(1);
283 void PDB_help(PARROT_INTERP
, ARGIN(const char *command
))
284 __attribute__nonnull__(1)
285 __attribute__nonnull__(2);
287 void PDB_info(PARROT_INTERP
)
288 __attribute__nonnull__(1);
290 void PDB_init(PARROT_INTERP
, SHIM(const char *command
))
291 __attribute__nonnull__(1);
293 void PDB_list(PARROT_INTERP
, ARGIN(const char *command
))
294 __attribute__nonnull__(1)
295 __attribute__nonnull__(2);
297 void PDB_load_source(PARROT_INTERP
, ARGIN(const char *command
))
298 __attribute__nonnull__(1)
299 __attribute__nonnull__(2);
301 void PDB_next(PARROT_INTERP
, ARGIN_NULLOK(const char *command
))
302 __attribute__nonnull__(1);
304 void PDB_print(PARROT_INTERP
, ARGIN(const char *command
))
305 __attribute__nonnull__(1)
306 __attribute__nonnull__(2);
308 char PDB_program_end(PARROT_INTERP
)
309 __attribute__nonnull__(1);
311 PARROT_IGNORABLE_RESULT
312 int PDB_run_command(PARROT_INTERP
, ARGIN(const char *command
))
313 __attribute__nonnull__(1)
314 __attribute__nonnull__(2);
316 void PDB_script_file(PARROT_INTERP
, ARGIN(const char *command
))
317 __attribute__nonnull__(1)
318 __attribute__nonnull__(2);
320 void PDB_set_break(PARROT_INTERP
, ARGIN_NULLOK(const char *command
))
321 __attribute__nonnull__(1);
323 void PDB_skip_breakpoint(PARROT_INTERP
, long i
)
324 __attribute__nonnull__(1);
326 void PDB_trace(PARROT_INTERP
, ARGIN_NULLOK(const char *command
))
327 __attribute__nonnull__(1);
329 int PDB_unescape(ARGMOD(char *string
))
330 __attribute__nonnull__(1)
331 FUNC_MODIFIES(*string
);
333 void PDB_watchpoint(PARROT_INTERP
, ARGIN(const char *command
))
334 __attribute__nonnull__(1)
335 __attribute__nonnull__(2);
337 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
338 /* HEADERIZER END: src/debug.c */
340 #endif /* PARROT_PDB_H_GUARD */
344 * c-file-style: "parrot"
346 * vim: expandtab shiftwidth=4: