proc.h revision f7fee43f72667f453bba5aaeea6b5490ece6792a
12b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata/*
22b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata * This file is part of ltrace.
32b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata * Copyright (C) 2010,2011,2012 Petr Machata, Red Hat Inc.
42b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata * Copyright (C) 2010 Joe Damato
52b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata * Copyright (C) 1998,2001,2008,2009 Juan Cespedes
62b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata *
72b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata * This program is free software; you can redistribute it and/or
82b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata * modify it under the terms of the GNU General Public License as
92b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata * published by the Free Software Foundation; either version 2 of the
102b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata * License, or (at your option) any later version.
112b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata *
122b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata * This program is distributed in the hope that it will be useful, but
132b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata * WITHOUT ANY WARRANTY; without even the implied warranty of
142b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
152b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata * General Public License for more details.
162b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata *
172b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata * You should have received a copy of the GNU General Public License
182b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata * along with this program; if not, write to the Free Software
192b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
202b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata * 02110-1301 USA
212b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata */
222b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata
23366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata#ifndef _PROC_H_
24366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata#define _PROC_H_
25366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata
26366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata#if defined(HAVE_LIBUNWIND)
27366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata# include <libunwind.h>
28366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata#endif /* defined(HAVE_LIBUNWIND) */
29366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata
30366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata#include "ltrace.h"
31366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata#include "dict.h"
32744f255ed0d676896dbe2f326b9c353c56438f0aPetr Machata#include "sysdep.h"
33366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata
342b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machatastruct library;
3552dbfb161efeab85bddc880966db2f7af9b9cf9aPetr Machatastruct breakpoint;
362b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata
372b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata/* XXX Move this somewhere where it makes sense.  When the mess in
382b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata * common.h is disentangled, that would actually be a good place for
392b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata * this.  */
402b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machataenum callback_status {
412b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata	CBS_STOP, /* The iteration should stop.  */
422b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata	CBS_CONT, /* The iteration should continue.  */
43ef7fa37f2d0b949b5afb1f326187e4f023d86c25Petr Machata	CBS_FAIL, /* There was an error.  The iteration should stop
44ef7fa37f2d0b949b5afb1f326187e4f023d86c25Petr Machata		   * and return error.  */
452b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata};
462b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata
47366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machatastruct event_handler {
48366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	/* Event handler that overrides the default one.  Should
49366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	 * return NULL if the event was handled, otherwise the
50366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	 * returned event is passed to the default handler.  */
51366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	Event *(*on_event)(struct event_handler *self, Event *event);
52366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata
53366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	/* Called when the event handler removal is requested.  */
54366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	void (*destroy)(struct event_handler *self);
55366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata};
56366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata
57366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machataenum process_state {
58366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	STATE_ATTACHED = 0,
59366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	STATE_BEING_CREATED,
60366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	STATE_IGNORED  /* ignore this process (it's a fork and no -f was used) */
61366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata};
62366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata
63366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machatastruct callstack_element {
64366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	union {
65366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata		int syscall;
66366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata		struct library_symbol * libfunc;
67366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	} c_un;
68366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	int is_syscall;
69366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	void * return_addr;
70366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	struct timeval time_spent;
71366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	void * arch_ptr;
72366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata};
73366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata
74366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata/* XXX We should get rid of this.  */
75366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata#define MAX_CALLDEPTH 64
76366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata
77366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata/* XXX We would rather have this all organized a little differently,
78366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata * have Process for the whole group and Task for what's there for
79366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata * per-thread stuff.  But for now this is the less invasive way of
80366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata * structuring it.  */
81fd43ef7bb48260aadd4d8335371f75015e680108Petr Machatatypedef struct Process Process;
82366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machatastruct Process {
83366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	enum process_state state;
84366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	Process * parent;         /* needed by STATE_BEING_CREATED */
85366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	char * filename;
86366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	pid_t pid;
87366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata
88366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	/* Dictionary of breakpoints (which is a mapping
89366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	 * address->breakpoint).  This is NULL for non-leader
90ecb082f480f057dc166c9d62e8776c892caf5e11Petr Machata	 * processes.  XXX note that we store addresses (keys) by
91ecb082f480f057dc166c9d62e8776c892caf5e11Petr Machata	 * value.  That assumes that target_address_t fits in host
92ecb082f480f057dc166c9d62e8776c892caf5e11Petr Machata	 * pointer.  */
93366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	Dict * breakpoints;
94366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata
95366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	int mask_32bit;           /* 1 if 64-bit ltrace is tracing 32-bit process */
96366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	unsigned int personality;
97366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	int tracesysgood;         /* signal indicating a PTRACE_SYSCALL trap */
98366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata
99366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	int callstack_depth;
100366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	struct callstack_element callstack[MAX_CALLDEPTH];
10176dd9290bd760f363a6f39db06020e61e3f7b345Petr Machata
10276dd9290bd760f363a6f39db06020e61e3f7b345Petr Machata	/* Linked list of libraries in backwards order of mapping.
10376dd9290bd760f363a6f39db06020e61e3f7b345Petr Machata	 * The last element is the executed binary itself.  */
1042b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata	struct library *libraries;
105366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata
106366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	/* Arch-dependent: */
107744f255ed0d676896dbe2f326b9c353c56438f0aPetr Machata	void *debug;	/* arch-dep process debug struct XXX move to
108744f255ed0d676896dbe2f326b9c353c56438f0aPetr Machata			 * os_process_data after it's invented.  */
109366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	void * instruction_pointer;
110366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	void * stack_pointer;      /* To get return addr, args... */
111366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	void * return_addr;
112366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	void * arch_ptr;
113366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	short e_machine;
114366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata#ifdef __arm__
115366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	int thumb_mode;           /* ARM execution mode: 0: ARM, 1: Thumb */
116366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata#endif
117366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata
118366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata#if defined(HAVE_LIBUNWIND)
119366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	/* libunwind address space */
120366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	unw_addr_space_t unwind_as;
121366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	void *unwind_priv;
122366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata#endif /* defined(HAVE_LIBUNWIND) */
123366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata
124366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	/* Set in leader.  */
125366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	struct event_handler *event_handler;
126366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata
127366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	/**
128366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	 * Process chaining.
129366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	 **/
130366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	Process * next;
131366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata
132366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	/* LEADER points to the leader thread of the POSIX.1 process.
133366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	   If X->LEADER == X, then X is the leader thread and the
134366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	   Process structures chained by NEXT represent other threads,
135366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	   up until, but not including, the next leader thread.
136366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	   LEADER may be NULL after the leader has already exited.  In
137366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	   that case this process is waiting to be collected.  */
138366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata	Process * leader;
139744f255ed0d676896dbe2f326b9c353c56438f0aPetr Machata
140744f255ed0d676896dbe2f326b9c353c56438f0aPetr Machata	struct arch_process_data arch;
141366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata};
142366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata
14375934ad3b30790f6a892069576d0790a351ef101Petr Machata/* Initialize a process given a path to binary FILENAME, with a PID,
14475934ad3b30790f6a892069576d0790a351ef101Petr Machata * and add the process to an internal chain of traced processes.  */
14575934ad3b30790f6a892069576d0790a351ef101Petr Machataint process_init(struct Process *proc, const char *filename, pid_t pid);
1462b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata
1473d0c91c0c7b425e2866f9c65f655d399693328a5Petr Machata/* PROC underwent an exec.  This is a bit like process_destroy
1483d0c91c0c7b425e2866f9c65f655d399693328a5Petr Machata * followed by process_init, except that some state is kept and the
1493d0c91c0c7b425e2866f9c65f655d399693328a5Petr Machata * process doesn't lose it's place in the list of processes.  */
1503d0c91c0c7b425e2866f9c65f655d399693328a5Petr Machataint process_exec(struct Process *proc);
1513d0c91c0c7b425e2866f9c65f655d399693328a5Petr Machata
1523d0c91c0c7b425e2866f9c65f655d399693328a5Petr Machata/* Release any memory allocated for PROC (but not PROC itself).  Does
1533d0c91c0c7b425e2866f9c65f655d399693328a5Petr Machata * NOT remove PROC from internal chain.
1543d0c91c0c7b425e2866f9c65f655d399693328a5Petr Machata *
1553d0c91c0c7b425e2866f9c65f655d399693328a5Petr Machata * XXX clearly this init/destroy pair is different than others and
1563d0c91c0c7b425e2866f9c65f655d399693328a5Petr Machata * should be fixed.  process_init should presumably be separate from
1573d0c91c0c7b425e2866f9c65f655d399693328a5Petr Machata * process_add.  */
1583d0c91c0c7b425e2866f9c65f655d399693328a5Petr Machatavoid process_destroy(struct Process *proc);
1593d0c91c0c7b425e2866f9c65f655d399693328a5Petr Machata
16075934ad3b30790f6a892069576d0790a351ef101Petr Machatastruct Process *open_program(const char *filename, pid_t pid);
161366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machatavoid open_pid(pid_t pid);
162366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr MachataProcess * pid2proc(pid_t pid);
1632b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata
1642b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata/* Clone the contents of PROC into the memory referenced by RETP.
1652b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata * Returns 0 on success or a negative value on failure.  */
1662b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machataint process_clone(struct Process *retp, struct Process *proc, pid_t pid);
1672b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata
1682b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata/* Iterate through the processes that ltrace currently traces.  CB is
1692b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata * called for each process.  Tasks are considered to be processes for
1702b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata * the purpose of this iterator.
1712b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata *
17274132a447b18c588c698ecfb8cf4ad4b16360f2fPetr Machata * Notes on this iteration interface: The iteration starts after the
17374132a447b18c588c698ecfb8cf4ad4b16360f2fPetr Machata * process designated by START_AFTER, or at the first process if
17474132a447b18c588c698ecfb8cf4ad4b16360f2fPetr Machata * START_AFTER is NULL.  DATA is passed verbatim to CB.  If CB returns
17574132a447b18c588c698ecfb8cf4ad4b16360f2fPetr Machata * CBS_STOP, the iteration stops and the current iterator is returned.
17674132a447b18c588c698ecfb8cf4ad4b16360f2fPetr Machata * That iterator can then be used to restart the iteration.  NULL is
1772b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata * returned when iteration ends.
1782b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata *
1792b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata * There's no provision for returning error states.  Errors need to be
1802b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata * signaled to the caller via DATA, together with any other data that
1812b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata * the callback needs.  */
18274132a447b18c588c698ecfb8cf4ad4b16360f2fPetr MachataProcess *each_process(Process *start_after,
1832b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata		      enum callback_status (*cb)(struct Process *proc,
1842b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata						 void *data),
185366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata		      void *data);
1862b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata
18774132a447b18c588c698ecfb8cf4ad4b16360f2fPetr Machata/* Iterate through list of tasks of given process PROC.  Restarts are
18874132a447b18c588c698ecfb8cf4ad4b16360f2fPetr Machata * supported via START_AFTER (see each_process for details of
18974132a447b18c588c698ecfb8cf4ad4b16360f2fPetr Machata * iteration interface).  */
19074132a447b18c588c698ecfb8cf4ad4b16360f2fPetr MachataProcess *each_task(struct Process *proc, struct Process *start_after,
1912b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata		   enum callback_status (*cb)(struct Process *proc,
1922b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata					      void *data),
193366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata		   void *data);
1942b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata
195366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machatavoid change_process_leader(Process *proc, Process *leader);
196366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machatavoid remove_process(Process *proc);
197366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machatavoid install_event_handler(Process *proc, struct event_handler *handler);
198366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machatavoid destroy_event_handler(Process *proc);
199366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata
2002b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata/* Add a library LIB to the list of PROC's libraries.  */
2012b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machatavoid proc_add_library(struct Process *proc, struct library *lib);
2022b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata
2032b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata/* Remove LIB from list of PROC's libraries.  Returns 0 if the library
2042b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata * was found and unlinked, otherwise returns a negative value.  */
2052b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machataint proc_remove_library(struct Process *proc, struct library *lib);
2062b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata
2072b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata/* Iterate through the libraries of PROC.  See each_process for
2082b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata * detailed description of the iteration interface.  */
2092b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machatastruct library *proc_each_library(struct Process *proc, struct library *start,
2102b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata				  enum callback_status (*cb)(struct Process *p,
2112b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata							     struct library *l,
2122b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata							     void *data),
2132b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata				  void *data);
2142b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata
21552dbfb161efeab85bddc880966db2f7af9b9cf9aPetr Machata/* Insert BP into PROC.  */
21652dbfb161efeab85bddc880966db2f7af9b9cf9aPetr Machataint proc_add_breakpoint(struct Process *proc, struct breakpoint *bp);
21752dbfb161efeab85bddc880966db2f7af9b9cf9aPetr Machata
218f7fee43f72667f453bba5aaeea6b5490ece6792aPetr Machata/* Remove BP from PROC.  This has no reason to fail in runtime.  If it
219f7fee43f72667f453bba5aaeea6b5490ece6792aPetr Machata * does not find BP in PROC, it's hard error guarded by assertion.  */
220f7fee43f72667f453bba5aaeea6b5490ece6792aPetr Machatavoid proc_remove_breakpoint(struct Process *proc, struct breakpoint *bp);
2212b46cfc1127d390eddd9593fe5ce5399c1f68130Petr Machata
222d3cc9889fdfe2e523e99ca5f664f8ae4b3936612Petr Machata/* Iterate through the libraries of PROC.  See each_process for
223d3cc9889fdfe2e523e99ca5f664f8ae4b3936612Petr Machata * detailed description of the iteration interface.  */
224d3cc9889fdfe2e523e99ca5f664f8ae4b3936612Petr Machatavoid *proc_each_breakpoint(struct Process *proc, void *start,
225d3cc9889fdfe2e523e99ca5f664f8ae4b3936612Petr Machata			   enum callback_status (*cb)(struct Process *proc,
226d3cc9889fdfe2e523e99ca5f664f8ae4b3936612Petr Machata						      struct breakpoint *bp,
227d3cc9889fdfe2e523e99ca5f664f8ae4b3936612Petr Machata						      void *data),
228d3cc9889fdfe2e523e99ca5f664f8ae4b3936612Petr Machata			   void *data);
229d3cc9889fdfe2e523e99ca5f664f8ae4b3936612Petr Machata
230366c2f46d844f040458df9b7e35fc3b8527ed2d3Petr Machata#endif /* _PROC_H_ */
231