2 * Copyright (C) 2006 Benjamin Otte <otte@gnome.org>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301 USA
20 #ifndef _SWFDEC_DEBUGGER_H_
21 #define _SWFDEC_DEBUGGER_H_
23 #include <glib-object.h>
24 #include <libswfdec/swfdec.h>
25 #include <libswfdec/swfdec_player_internal.h>
26 #include <libswfdec/swfdec_script.h>
27 #include <libswfdec/swfdec_types.h>
31 //typedef struct _SwfdecDebugger SwfdecDebugger;
32 typedef struct _SwfdecDebuggerClass SwfdecDebuggerClass
;
33 typedef struct _SwfdecDebuggerScript SwfdecDebuggerScript
;
34 typedef struct _SwfdecDebuggerCommand SwfdecDebuggerCommand
;
36 #define SWFDEC_TYPE_DEBUGGER (swfdec_debugger_get_type())
37 #define SWFDEC_IS_DEBUGGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWFDEC_TYPE_DEBUGGER))
38 #define SWFDEC_IS_DEBUGGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SWFDEC_TYPE_DEBUGGER))
39 #define SWFDEC_DEBUGGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWFDEC_TYPE_DEBUGGER, SwfdecDebugger))
40 #define SWFDEC_DEBUGGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SWFDEC_TYPE_DEBUGGER, SwfdecDebuggerClass))
41 #define SWFDEC_DEBUGGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SWFDEC_TYPE_DEBUGGER, SwfdecDebuggerClass))
43 struct _SwfdecDebuggerCommand
{
44 const guint8
* code
; /* pointer to start bytecode in SwfdecScript */
45 char * description
; /* string describing the action */
48 struct _SwfdecDebuggerScript
{
49 SwfdecScript
* script
; /* the script */
50 SwfdecDebuggerCommand
*commands
; /* commands executed in the script (NULL-terminated) */
51 guint n_commands
; /* number of commands */
54 struct _SwfdecDebugger
{
57 GHashTable
* scripts
; /* JSScript => SwfdecDebuggerScript mapping */
58 GArray
* breakpoints
; /* all breakpoints */
59 gboolean stepping
; /* TRUE if we're currently stepping through the code */
60 gboolean has_breakpoints
; /* performance: track if there's breakpoints */
63 struct _SwfdecDebuggerClass
{
64 SwfdecPlayerClass player_class
;
67 GType
swfdec_debugger_get_type (void);
68 SwfdecPlayer
* swfdec_debugger_new (void);
70 gboolean
swfdec_debugger_get_current (SwfdecDebugger
* debugger
,
71 SwfdecDebuggerScript
**dscript
,
73 guint
swfdec_debugger_set_breakpoint (SwfdecDebugger
* debugger
,
74 SwfdecDebuggerScript
* script
,
76 void swfdec_debugger_unset_breakpoint
77 (SwfdecDebugger
* debugger
,
79 gboolean
swfdec_debugger_get_breakpoint (SwfdecDebugger
* debugger
,
81 SwfdecDebuggerScript
**script
,
83 guint swfdec_debugger_get_n_breakpoints
84 (SwfdecDebugger
* debugger
);
85 void swfdec_debugger_set_stepping (SwfdecDebugger
* debugger
,
87 gboolean
swfdec_debugger_get_stepping (SwfdecDebugger
* debugger
);
89 void swfdec_debugger_add_script (SwfdecDebugger
* debugger
,
90 SwfdecScript
* script
);
91 SwfdecDebuggerScript
* swfdec_debugger_get_script (SwfdecDebugger
* debugger
,
92 SwfdecScript
* script
);
93 void swfdec_debugger_remove_script (SwfdecDebugger
* debugger
,
94 SwfdecScript
* script
);
95 void swfdec_debugger_foreach_script (SwfdecDebugger
* debugger
,
98 guint swfdec_debugger_script_has_breakpoint
99 (SwfdecDebugger
* debugger
,
100 SwfdecDebuggerScript
* script
,
103 const char * swfdec_debugger_run (SwfdecDebugger
* debugger
,
104 const char * command
);