1 /* -*- mode: C; c-file-style: "linux" -*- */
3 /* MemProf -- memory profiler and leak detector
4 * Copyright 1999, 2000, 2001, Red Hat, Inc.
5 * Copyright 2002, Kristian Rietveld
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
30 #include <glib-object.h>
34 #define MP_TYPE_PROCESS (mp_process_get_type ())
35 #define MP_PROCESS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MP_TYPE_PROCESS, MPProcess))
36 #define MP_PROCESS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MP_TYPE_PROCESS, MPProcessClass))
37 #define MP_IS_PROCESS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MP_TYPE_PROCESS))
38 #define MP_IS_PROCESS_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE ((obj), MP_TYPE_PROCESS))
39 #define MP_PROCESS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MP_TYPE_PROCESS, MPProcessClass))
41 /* forward declaration */
42 typedef struct _MPServer MPServer
;
44 typedef struct _MPProcess MPProcess
;
45 typedef struct _MPProcessClass MPProcessClass
;
48 MP_PROCESS_INIT
, /* Newly created */
49 MP_PROCESS_STARTING
, /* Run child, waiting for it to connect */
50 MP_PROCESS_RUNNING
, /* Child is running */
51 MP_PROCESS_EXITING
, /* _exit() has been called in child */
52 MP_PROCESS_DEFUNCT
, /* child no longer exists */
53 MP_PROCESS_DETACHED
/* we now ignore this child */
56 typedef void (*MPProcessBlockForeachFunc
) (Block
*block
,
61 GObject parent_instance
;
63 MPProcessStatus status
;
78 GIOChannel
*input_channel
;
82 GHashTable
*block_table
;
84 StackStash
*stack_stash
;
92 struct _MPProcessClass
{
93 GObjectClass parent_class
;
95 void (*status_changed
) (MPProcess
*process
);
96 void (*reset
) (MPProcess
*process
);
99 GType
mp_process_get_type (void);
100 MPProcess
* process_new (MPServer
*server
);
101 MPProcess
* process_duplicate (MPProcess
*process
);
102 void process_set_follow_fork (MPProcess
*process
,
103 gboolean follow_fork
);
104 void process_set_follow_exec (MPProcess
*process
,
105 gboolean follow_exec
);
107 void process_run (MPProcess
*process
,
110 void process_detach (MPProcess
*process
);
111 void process_kill (MPProcess
*process
);
112 void process_exec_reset (MPProcess
*process
);
113 void process_set_status (MPProcess
*process
,
114 MPProcessStatus status
);
115 char *process_get_status_text (MPProcess
*process
);
116 char *process_get_cmdline (MPProcess
*process
);
118 void process_sections (MPProcess
*process
,
121 GList
* process_get_clones (MPProcess
*process
);
122 void process_start_input (MPProcess
*process
);
123 void process_stop_input (MPProcess
*process
);
124 void process_clear_input (MPProcess
*process
);
125 void process_dump_stack (MPProcess
*process
,
128 const char * process_locate_symbol (MPProcess
*process
,
131 char ** process_parse_exec (const char *exec_string
);
132 char * process_find_exec (char **args
);
134 void process_block_foreach (MPProcess
*process
,
135 MPProcessBlockForeachFunc foreach_func
,
137 gboolean
process_find_line (MPProcess
*process
, void *address
,
138 const char **filename
, char **functionname
,
141 #endif /* __PROCESS_H__ */