process.c: Use the symbol, it looks like it was meant to be used...
[memprof.git] / src / process.h
blob24e3793b1e2d1cc1e32b0901c405b4052ca261c0
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.
21 /*====*/
23 #ifndef __PROCESS_H__
24 #define __PROCESS_H__
26 #include <stdio.h>
27 #include <glib.h>
28 #include <unistd.h>
30 #include <glib-object.h>
32 #include "memprof.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;
47 typedef enum {
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 */
54 } MPProcessStatus;
56 typedef void (*MPProcessBlockForeachFunc) (Block *block,
57 gpointer data);
59 struct _MPProcess
61 GObject parent_instance;
63 MPProcessStatus status;
65 pid_t pid;
66 gchar *program_name;
68 MPServer *server;
70 MPProcess *clone_of;
71 MPProcess *parent;
72 guint seqno;
74 guint bytes_used;
75 guint n_allocations;
77 gint input_tag;
78 GIOChannel *input_channel;
80 GList *map_list;
81 GList *bad_pages;
82 GHashTable *block_table;
84 StackStash *stack_stash;
86 GList *command_queue;
88 gboolean follow_fork;
89 gboolean follow_exec;
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,
108 const char *path,
109 char **args);
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,
119 SectionFunc func,
120 gpointer user_data);
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,
126 FILE *out,
127 StackNode *stack);
128 const char * process_locate_symbol (MPProcess *process,
129 guint addr);
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,
136 gpointer data);
137 gboolean process_find_line (MPProcess *process, void *address,
138 const char **filename, char **functionname,
139 unsigned int *line);
141 #endif /* __PROCESS_H__ */