2 * Copyright (C) 2002-2008, 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 */
35 PDB_cond_int
= 1 << 0,
36 PDB_cond_num
= 1 << 1,
37 PDB_cond_str
= 1 << 2,
38 PDB_cond_pmc
= 1 << 3,
45 PDB_cond_const
= 1 << 10,
46 PDB_cond_notnull
= 1 << 11
50 * Conditions for breakpoint or watchpoints.
52 * type: The type of condition and the way to use arguments.
53 * reg: The register involved, there must be at least one.
54 * value: A pointer to the second argument.
55 * next: A pointer to the next condition - used to construct a
56 * list of watchpoints; not used for conditional breakpoints
59 typedef struct PDB_condition
*PDB_condition_ptr
;
61 typedef struct PDB_condition
{
64 unsigned char dummy
; /* For alignment XXX ?? */
65 void *value
; /* What neeeds to be aligned with what? */
66 PDB_condition_ptr next
;
70 * A label in the source file.
72 * opcode: The pointer to the bytecode where the label is.
73 * number: Number label.
74 * next: The next label.
77 typedef struct PDB_label
*PDB_label_ptr
;
79 typedef struct PDB_label
{
80 const opcode_t
*opcode
;
86 * A line in the source file.
88 * opcode: A pointer to the opcode in the bytecode corresponding to
90 * source_offset: Offset from the source file start.
91 * number: Line number.
92 * label: The label if any.
93 * next: The next line (if any).
95 typedef struct PDB_line
*PDB_line_ptr
;
97 typedef struct PDB_line
{
99 ptrdiff_t source_offset
;
100 unsigned long number
;
106 * A source code file.
108 * sourcefilename: The source code file name.
109 * source: The file itself.
110 * size: The size of the file in bytes.
111 * list_line: The next line to list.
112 * line: The first line of the source code.
113 * label: The first label.
114 * next: The next file (if any); multiple files are not currently
117 typedef struct PDB_file
*PDB_file_ptr
;
119 typedef struct PDB_file
{
120 char *sourcefilename
;
123 unsigned long list_line
;
130 * List of breakpoints.
132 * pc: Where the breakpoint is
133 * id: The identification number of this breakpoint
134 * skip: The number of times to skip this breakpoint
135 * condition: The condition attached to the breakpoint; may be NULL
136 * prev, next: The previous & next breakpoints in the list; may be NULL.
139 typedef struct PDB_breakpoint
*PDB_breakpoint_ptr
;
141 typedef struct PDB_breakpoint
{
145 PDB_condition_t
*condition
;
146 PDB_breakpoint_ptr prev
;
147 PDB_breakpoint_ptr next
;
153 * file: Source code file.
154 * breakpoint: The first breakpoint.
155 * watchpoint: The first watchpoint
156 * breakpoint_skip: Number of breakpoints to skip.
157 * cur_command: The command being executed.
158 * last_command: Last command executed.
159 * cur_opcode: Current opcode.
160 * state: The status of the program being debugged.
161 * debugee: The interpreter we are debugging
162 * debugger: The debugger interpreter
167 PDB_breakpoint_t
*breakpoint
;
168 PDB_condition_t
*watchpoint
;
169 long breakpoint_skip
;
172 opcode_t
*cur_opcode
;
176 unsigned long tracing
;
178 unsigned long script_line
;
182 /* HEADERIZER BEGIN: src/debug.c */
183 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
186 void Parrot_debugger_break(PARROT_INTERP
, ARGIN(opcode_t
* cur_opcode
))
187 __attribute__nonnull__(1)
188 __attribute__nonnull__(2);
191 void Parrot_debugger_destroy(PARROT_INTERP
)
192 __attribute__nonnull__(1);
195 void Parrot_debugger_init(PARROT_INTERP
)
196 __attribute__nonnull__(1);
199 void Parrot_debugger_load(PARROT_INTERP
, ARGIN_NULLOK(STRING
*filename
))
200 __attribute__nonnull__(1);
203 void Parrot_debugger_start(PARROT_INTERP
, ARGIN(opcode_t
* cur_opcode
))
204 __attribute__nonnull__(1)
205 __attribute__nonnull__(2);
208 void PDB_load_source(PARROT_INTERP
, ARGIN(const char *command
))
209 __attribute__nonnull__(1)
210 __attribute__nonnull__(2);
213 void PDB_script_file(PARROT_INTERP
, ARGIN(const char *command
))
214 __attribute__nonnull__(1)
215 __attribute__nonnull__(2);
218 ARGMOD(PDB_file_t
*file
),
219 ARGIN(const opcode_t
*cur_opcode
),
221 __attribute__nonnull__(1)
222 __attribute__nonnull__(2)
223 FUNC_MODIFIES(*file
);
225 void PDB_backtrace(PARROT_INTERP
)
226 __attribute__nonnull__(1);
228 PARROT_WARN_UNUSED_RESULT
229 char PDB_break(PARROT_INTERP
)
230 __attribute__nonnull__(1);
232 PARROT_WARN_UNUSED_RESULT
233 char PDB_check_condition(PARROT_INTERP
,
234 ARGIN(const PDB_condition_t
*condition
))
235 __attribute__nonnull__(1)
236 __attribute__nonnull__(2);
238 PARROT_CAN_RETURN_NULL
239 opcode_t
* PDB_compile(PARROT_INTERP
, ARGIN(const char *command
))
240 __attribute__nonnull__(1)
241 __attribute__nonnull__(2);
243 PARROT_CAN_RETURN_NULL
244 PDB_condition_t
* PDB_cond(PARROT_INTERP
, ARGIN(const char *command
))
245 __attribute__nonnull__(1)
246 __attribute__nonnull__(2);
248 void PDB_continue(PARROT_INTERP
, ARGIN_NULLOK(const char *command
))
249 __attribute__nonnull__(1);
251 void PDB_delete_breakpoint(PARROT_INTERP
, ARGIN(const char *command
))
252 __attribute__nonnull__(1)
253 __attribute__nonnull__(2);
255 void PDB_delete_condition(SHIM_INTERP
, ARGMOD(PDB_breakpoint_t
*breakpoint
))
256 __attribute__nonnull__(2)
257 FUNC_MODIFIES(*breakpoint
);
259 void PDB_disable_breakpoint(PARROT_INTERP
, ARGIN(const char *command
))
260 __attribute__nonnull__(1)
261 __attribute__nonnull__(2);
263 void PDB_disassemble(PARROT_INTERP
, SHIM(const char *command
))
264 __attribute__nonnull__(1);
266 size_t PDB_disassemble_op(PARROT_INTERP
,
269 ARGIN(const op_info_t
*info
),
270 ARGIN(const opcode_t
*op
),
271 ARGMOD_NULLOK(PDB_file_t
*file
),
272 ARGIN_NULLOK(const opcode_t
*code_start
),
274 __attribute__nonnull__(1)
275 __attribute__nonnull__(2)
276 __attribute__nonnull__(4)
277 __attribute__nonnull__(5)
278 FUNC_MODIFIES(*dest
);
280 void PDB_enable_breakpoint(PARROT_INTERP
, ARGIN(const char *command
))
281 __attribute__nonnull__(1)
282 __attribute__nonnull__(2);
284 PARROT_WARN_UNUSED_RESULT
285 PARROT_CAN_RETURN_NULL
287 char * PDB_escape(ARGIN(const char *string
), INTVAL length
)
288 __attribute__nonnull__(1);
290 void PDB_eval(PARROT_INTERP
, ARGIN(const char *command
))
291 __attribute__nonnull__(1)
292 __attribute__nonnull__(2);
294 PARROT_CAN_RETURN_NULL
295 PARROT_WARN_UNUSED_RESULT
296 PDB_breakpoint_t
* PDB_find_breakpoint(PARROT_INTERP
,
297 ARGIN(const char *command
))
298 __attribute__nonnull__(1)
299 __attribute__nonnull__(2);
301 void PDB_free_file(PARROT_INTERP
)
302 __attribute__nonnull__(1);
304 void PDB_get_command(PARROT_INTERP
)
305 __attribute__nonnull__(1);
307 PARROT_WARN_UNUSED_RESULT
309 char PDB_hasinstruction(ARGIN(const char *c
))
310 __attribute__nonnull__(1);
312 void PDB_help(PARROT_INTERP
, ARGIN(const char *command
))
313 __attribute__nonnull__(1)
314 __attribute__nonnull__(2);
316 void PDB_info(PARROT_INTERP
)
317 __attribute__nonnull__(1);
319 void PDB_init(PARROT_INTERP
, SHIM(const char *command
))
320 __attribute__nonnull__(1);
322 void PDB_list(PARROT_INTERP
, ARGIN(const char *command
))
323 __attribute__nonnull__(1)
324 __attribute__nonnull__(2);
326 void PDB_next(PARROT_INTERP
, ARGIN_NULLOK(const char *command
))
327 __attribute__nonnull__(1);
329 void PDB_print(PARROT_INTERP
, ARGIN(const char *command
))
330 __attribute__nonnull__(1)
331 __attribute__nonnull__(2);
333 char PDB_program_end(PARROT_INTERP
)
334 __attribute__nonnull__(1);
336 PARROT_IGNORABLE_RESULT
337 int PDB_run_command(PARROT_INTERP
, ARGIN(const char *command
))
338 __attribute__nonnull__(1)
339 __attribute__nonnull__(2);
341 void PDB_set_break(PARROT_INTERP
, ARGIN_NULLOK(const char *command
))
342 __attribute__nonnull__(1);
344 void PDB_skip_breakpoint(PARROT_INTERP
, long i
)
345 __attribute__nonnull__(1);
347 void PDB_trace(PARROT_INTERP
, ARGIN_NULLOK(const char *command
))
348 __attribute__nonnull__(1);
350 int PDB_unescape(ARGMOD(char *string
))
351 __attribute__nonnull__(1)
352 FUNC_MODIFIES(*string
);
354 void PDB_watchpoint(PARROT_INTERP
, ARGIN(const char *command
))
355 __attribute__nonnull__(1)
356 __attribute__nonnull__(2);
358 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
359 /* HEADERIZER END: src/debug.c */
361 #endif /* PARROT_PDB_H_GUARD */
365 * c-file-style: "parrot"
367 * vim: expandtab shiftwidth=4: