blob: 450472ae8a3aceaed3595706e85f4180724c86cc [file] [log] [blame]
Petr Machatae99af272012-10-26 00:29:52 +02001/*
2 * This file is part of ltrace.
3 * Copyright (C) 2006,2007,2011,2012 Petr Machata, Red Hat Inc.
4 * Copyright (C) 2009 Juan Cespedes
5 * Copyright (C) 1998,2001,2002,2003,2007,2008,2009 Juan Cespedes
6 * Copyright (C) 2006 Ian Wienand
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of the
11 * License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21 * 02110-1301 USA
22 */
23
Juan Cespedesd44c6b81998-09-25 14:48:42 +020024#include "config.h"
Juan Cespedesd44c6b81998-09-25 14:48:42 +020025
Juan Cespedes5b3ffdf2001-07-02 00:52:45 +020026#include <assert.h>
Petr Machata2b46cfc2012-02-18 11:17:29 +010027#include <errno.h>
Petr Machataba1664b2012-04-28 14:59:05 +020028#include <stdio.h>
29#include <stdlib.h>
30#include <string.h>
Juan Cespedes5b3ffdf2001-07-02 00:52:45 +020031
Juan Cespedesf1bfe202002-03-27 00:22:23 +010032#ifdef __powerpc__
33#include <sys/ptrace.h>
34#endif
35
Petr Machata64262602012-01-07 03:41:36 +010036#include "backend.h"
Petr Machataba1664b2012-04-28 14:59:05 +020037#include "breakpoint.h"
38#include "debug.h"
39#include "library.h"
40#include "ltrace-elf.h"
41#include "proc.h"
Juan Cespedes5b3ffdf2001-07-02 00:52:45 +020042
Petr Machatac67a6e62012-03-28 02:39:49 +020043#ifndef ARCH_HAVE_TRANSLATE_ADDRESS
44int
Petr Machatab1492df2012-04-30 21:01:40 +020045arch_translate_address_dyn(struct Process *proc,
Petr Machatabac2da52012-05-29 00:42:59 +020046 arch_addr_t addr, arch_addr_t *ret)
Petr Machatab1492df2012-04-30 21:01:40 +020047{
48 *ret = addr;
49 return 0;
50}
51
52struct ltelf;
53int
54arch_translate_address(struct ltelf *lte,
Petr Machatabac2da52012-05-29 00:42:59 +020055 arch_addr_t addr, arch_addr_t *ret)
Petr Machatac67a6e62012-03-28 02:39:49 +020056{
57 *ret = addr;
58 return 0;
59}
60#endif
61
Petr Machataa9fd8f42012-02-07 13:25:56 +010062void
63breakpoint_on_hit(struct breakpoint *bp, struct Process *proc)
64{
65 assert(bp != NULL);
66 if (bp->cbs != NULL && bp->cbs->on_hit != NULL)
Petr Machata55ac9322012-03-27 03:07:35 +020067 (bp->cbs->on_hit)(bp, proc);
68}
69
70void
71breakpoint_on_continue(struct breakpoint *bp, struct Process *proc)
72{
73 assert(bp != NULL);
74 if (bp->cbs != NULL && bp->cbs->on_continue != NULL)
75 (bp->cbs->on_continue)(bp, proc);
76 else
77 continue_after_breakpoint(proc, bp);
Petr Machataa9fd8f42012-02-07 13:25:56 +010078}
79
Petr Machata86d38282012-04-24 18:09:01 +020080void
81breakpoint_on_retract(struct breakpoint *bp, struct Process *proc)
82{
83 assert(bp != NULL);
84 if (bp->cbs != NULL && bp->cbs->on_retract != NULL)
85 (bp->cbs->on_retract)(bp, proc);
86}
87
Juan Cespedes5b3ffdf2001-07-02 00:52:45 +020088/*****************************************************************************/
89
Petr Machata9294d822012-02-07 12:35:58 +010090struct breakpoint *
Petr Machatafed1e8d2012-02-07 02:06:29 +010091address2bpstruct(Process *proc, void *addr)
92{
Petr Machata26627682011-07-08 18:15:32 +020093 assert(proc != NULL);
94 assert(proc->breakpoints != NULL);
Petr Machata9a5420c2011-07-09 11:21:23 +020095 assert(proc->leader == proc);
Juan Cespedescd8976d2009-05-14 13:47:58 +020096 debug(DEBUG_FUNCTION, "address2bpstruct(pid=%d, addr=%p)", proc->pid, addr);
Juan Cespedescac15c32003-01-31 18:58:58 +010097 return dict_find_entry(proc->breakpoints, addr);
Juan Cespedes5b3ffdf2001-07-02 00:52:45 +020098}
99
Petr Machata8cce1192012-03-25 01:37:19 +0100100#ifndef ARCH_HAVE_BREAKPOINT_DATA
Petr Machata2b46cfc2012-02-18 11:17:29 +0100101int
102arch_breakpoint_init(struct Process *proc, struct breakpoint *sbp)
103{
104 return 0;
105}
Petr Machata8cce1192012-03-25 01:37:19 +0100106
107void
108arch_breakpoint_destroy(struct breakpoint *sbp)
109{
110}
Petr Machatad3cc9882012-04-13 21:40:23 +0200111
112int
113arch_breakpoint_clone(struct breakpoint *retp, struct breakpoint *sbp)
114{
115 return 0;
116}
Petr Machata2b46cfc2012-02-18 11:17:29 +0100117#endif
118
Petr Machatad3cc9882012-04-13 21:40:23 +0200119static void
120breakpoint_init_base(struct breakpoint *bp, struct Process *proc,
Petr Machatabac2da52012-05-29 00:42:59 +0200121 arch_addr_t addr, struct library_symbol *libsym)
Petr Machatad3cc9882012-04-13 21:40:23 +0200122{
123 bp->cbs = NULL;
124 bp->addr = addr;
125 memset(bp->orig_value, 0, sizeof(bp->orig_value));
126 bp->enabled = 0;
127 bp->libsym = libsym;
128}
129
Petr Machata52dbfb12012-03-29 16:38:26 +0200130/* On second thought, I don't think we need PROC. All the translation
131 * (arch_translate_address in particular) should be doable using
132 * static lookups of various sections in the ELF file. We shouldn't
133 * need process for anything. */
Petr Machata2b46cfc2012-02-18 11:17:29 +0100134int
135breakpoint_init(struct breakpoint *bp, struct Process *proc,
Petr Machatabac2da52012-05-29 00:42:59 +0200136 arch_addr_t addr, struct library_symbol *libsym)
Petr Machata2b46cfc2012-02-18 11:17:29 +0100137{
Petr Machatad3cc9882012-04-13 21:40:23 +0200138 breakpoint_init_base(bp, proc, addr, libsym);
Petr Machata2b46cfc2012-02-18 11:17:29 +0100139 return arch_breakpoint_init(proc, bp);
140}
141
Petr Machata8cce1192012-03-25 01:37:19 +0100142void
Petr Machata55ac9322012-03-27 03:07:35 +0200143breakpoint_set_callbacks(struct breakpoint *bp, struct bp_callbacks *cbs)
144{
145 if (bp->cbs != NULL)
146 assert(bp->cbs == NULL);
147 bp->cbs = cbs;
148}
149
150void
Petr Machata8cce1192012-03-25 01:37:19 +0100151breakpoint_destroy(struct breakpoint *bp)
152{
153 if (bp == NULL)
154 return;
Petr Machata8cce1192012-03-25 01:37:19 +0100155 arch_breakpoint_destroy(bp);
156}
157
Petr Machatad3cc9882012-04-13 21:40:23 +0200158struct find_symbol_data {
159 struct library_symbol *old_libsym;
160 struct library_symbol *found_libsym;
161};
162
163static enum callback_status
164find_sym_in_lib(struct Process *proc, struct library *lib, void *u)
165{
166 struct find_symbol_data *fs = u;
167 fs->found_libsym
168 = library_each_symbol(lib, NULL, library_symbol_equal_cb,
169 fs->old_libsym);
170 return fs->found_libsym != NULL ? CBS_STOP : CBS_CONT;
171}
172
173int
174breakpoint_clone(struct breakpoint *retp, struct Process *new_proc,
175 struct breakpoint *bp, struct Process *old_proc)
176{
177 /* Find library and symbol that this breakpoint was linked to. */
178 struct library_symbol *libsym = bp->libsym;
179 struct library *lib = NULL;
180 if (libsym != NULL) {
181 struct find_symbol_data f_data = {
182 .old_libsym = libsym,
183 };
184 lib = proc_each_library(old_proc, NULL,
185 find_sym_in_lib, &f_data);
186 assert(lib != NULL);
187 libsym = f_data.found_libsym;
188 }
189
190 /* LIB and LIBSYM now hold the new library and symbol that
191 * correspond to the original breakpoint. Now we can do the
192 * clone itself. */
193 breakpoint_init_base(retp, new_proc, bp->addr, libsym);
194 memcpy(retp->orig_value, bp->orig_value, sizeof(bp->orig_value));
195 retp->enabled = bp->enabled;
Petr Machatad3cc9882012-04-13 21:40:23 +0200196 if (arch_breakpoint_clone(retp, bp) < 0)
197 return -1;
198 breakpoint_set_callbacks(retp, bp->cbs);
199 return 0;
200}
201
Petr Machata52dbfb12012-03-29 16:38:26 +0200202int
Petr Machatafa0c5702012-04-13 18:43:40 +0200203breakpoint_turn_on(struct breakpoint *bp, struct Process *proc)
Petr Machata52dbfb12012-03-29 16:38:26 +0200204{
Petr Machata52dbfb12012-03-29 16:38:26 +0200205 bp->enabled++;
206 if (bp->enabled == 1) {
Petr Machatafa0c5702012-04-13 18:43:40 +0200207 assert(proc->pid != 0);
208 enable_breakpoint(proc, bp);
Petr Machata52dbfb12012-03-29 16:38:26 +0200209 }
210 return 0;
211}
212
213int
Petr Machatafa0c5702012-04-13 18:43:40 +0200214breakpoint_turn_off(struct breakpoint *bp, struct Process *proc)
Petr Machata52dbfb12012-03-29 16:38:26 +0200215{
Petr Machata52dbfb12012-03-29 16:38:26 +0200216 bp->enabled--;
217 if (bp->enabled == 0)
Petr Machatafa0c5702012-04-13 18:43:40 +0200218 disable_breakpoint(proc, bp);
Petr Machata52dbfb12012-03-29 16:38:26 +0200219 assert(bp->enabled >= 0);
220 return 0;
221}
222
Petr Machata9294d822012-02-07 12:35:58 +0100223struct breakpoint *
Petr Machata9df15012012-02-20 12:49:46 +0100224insert_breakpoint(struct Process *proc, void *addr,
225 struct library_symbol *libsym)
Petr Machatafed1e8d2012-02-07 02:06:29 +0100226{
Petr Machata9df15012012-02-20 12:49:46 +0100227 Process *leader = proc->leader;
Petr Machata9a5420c2011-07-09 11:21:23 +0200228
229 /* Only the group leader should be getting the breakpoints and
230 * thus have ->breakpoint initialized. */
231 assert(leader != NULL);
232 assert(leader->breakpoints != NULL);
233
Petr Machata050b0a62012-04-03 01:30:30 +0200234 debug(DEBUG_FUNCTION, "insert_breakpoint(pid=%d, addr=%p, symbol=%s)",
235 proc->pid, addr, libsym ? libsym->name : "NULL");
Juan Cespedes5b3ffdf2001-07-02 00:52:45 +0200236
Petr Machata218c5ff2012-04-15 04:22:39 +0200237 assert(addr != 0);
Ian Wienand9a2ad352006-02-20 22:44:45 +0100238
Petr Machata52dbfb12012-03-29 16:38:26 +0200239 /* XXX what we need to do instead is have a list of
240 * breakpoints that are enabled at this address. The
241 * following works if every breakpoint is the same and there's
242 * no extra data, but that doesn't hold anymore. For now it
243 * will suffice, about the only realistic case where we need
244 * to have more than one breakpoint per address is return from
245 * a recursive library call. */
Petr Machata2b46cfc2012-02-18 11:17:29 +0100246 struct breakpoint *sbp = dict_find_entry(leader->breakpoints, addr);
Petr Machatafed1e8d2012-02-07 02:06:29 +0100247 if (sbp == NULL) {
Petr Machata2b46cfc2012-02-18 11:17:29 +0100248 sbp = malloc(sizeof(*sbp));
249 if (sbp == NULL
Petr Machata52dbfb12012-03-29 16:38:26 +0200250 || breakpoint_init(sbp, proc, addr, libsym) < 0) {
251 free(sbp);
252 return NULL;
253 }
Petr Machatafa0c5702012-04-13 18:43:40 +0200254 if (proc_add_breakpoint(leader, sbp) < 0) {
Petr Machata52dbfb12012-03-29 16:38:26 +0200255 fail:
256 breakpoint_destroy(sbp);
Petr Machata2b46cfc2012-02-18 11:17:29 +0100257 free(sbp);
258 return NULL;
Juan Cespedescac15c32003-01-31 18:58:58 +0100259 }
Juan Cespedescac15c32003-01-31 18:58:58 +0100260 }
Petr Machata2b46cfc2012-02-18 11:17:29 +0100261
Petr Machata45728772012-04-15 04:23:55 +0200262 if (breakpoint_turn_on(sbp, proc) < 0) {
263 proc_remove_breakpoint(leader, sbp);
Petr Machata52dbfb12012-03-29 16:38:26 +0200264 goto fail;
Petr Machata45728772012-04-15 04:23:55 +0200265 }
Petr Machata9294d822012-02-07 12:35:58 +0100266
267 return sbp;
Juan Cespedes5b3ffdf2001-07-02 00:52:45 +0200268}
269
Juan Cespedesf1350522008-12-16 18:19:58 +0100270void
Petr Machatafed1e8d2012-02-07 02:06:29 +0100271delete_breakpoint(Process *proc, void *addr)
272{
Juan Cespedescd8976d2009-05-14 13:47:58 +0200273 debug(DEBUG_FUNCTION, "delete_breakpoint(pid=%d, addr=%p)", proc->pid, addr);
274
Petr Machata9a5420c2011-07-09 11:21:23 +0200275 Process * leader = proc->leader;
276 assert(leader != NULL);
277
Petr Machataf7fee432012-04-19 17:00:53 +0200278 struct breakpoint *sbp = dict_find_entry(leader->breakpoints, addr);
279 assert(sbp != NULL);
Juan Cespedes5b3ffdf2001-07-02 00:52:45 +0200280 /* This should only happen on out-of-memory conditions. */
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100281 if (sbp == NULL)
282 return;
Juan Cespedes5b3ffdf2001-07-02 00:52:45 +0200283
Petr Machatafa0c5702012-04-13 18:43:40 +0200284 if (breakpoint_turn_off(sbp, proc) < 0) {
Petr Machata52dbfb12012-03-29 16:38:26 +0200285 fprintf(stderr, "Couldn't turn off the breakpoint %s@%p\n",
286 breakpoint_name(sbp), sbp->addr);
287 return;
288 }
Petr Machataf7fee432012-04-19 17:00:53 +0200289 if (sbp->enabled == 0) {
290 proc_remove_breakpoint(leader, sbp);
291 breakpoint_destroy(sbp);
292 free(sbp);
293 }
Juan Cespedes5b3ffdf2001-07-02 00:52:45 +0200294}
295
Petr Machatae9aebd62012-03-25 01:38:53 +0100296const char *
297breakpoint_name(const struct breakpoint *bp)
298{
299 assert(bp != NULL);
300 return bp->libsym != NULL ? bp->libsym->name : NULL;
301}
302
Petr Machata52dbfb12012-03-29 16:38:26 +0200303struct library *
304breakpoint_library(const struct breakpoint *bp)
305{
306 assert(bp != NULL);
307 return bp->libsym != NULL ? bp->libsym->lib : NULL;
308}
309
Juan Cespedesf1350522008-12-16 18:19:58 +0100310static void
Petr Machatafed1e8d2012-02-07 02:06:29 +0100311enable_bp_cb(void *addr, void *sbp, void *proc)
312{
Juan Cespedescd8976d2009-05-14 13:47:58 +0200313 debug(DEBUG_FUNCTION, "enable_bp_cb(pid=%d)", ((Process *)proc)->pid);
Petr Machatabc373262012-02-07 23:31:15 +0100314 if (((struct breakpoint *)sbp)->enabled)
Petr Machataf789c9c2011-07-09 10:54:27 +0200315 enable_breakpoint(proc, sbp);
Juan Cespedes5b3ffdf2001-07-02 00:52:45 +0200316}
317
Juan Cespedesf1350522008-12-16 18:19:58 +0100318void
Petr Machatabc373262012-02-07 23:31:15 +0100319enable_all_breakpoints(Process *proc)
320{
Juan Cespedescd8976d2009-05-14 13:47:58 +0200321 debug(DEBUG_FUNCTION, "enable_all_breakpoints(pid=%d)", proc->pid);
Petr Machata61196a42012-02-07 16:41:03 +0100322
323 debug(1, "Enabling breakpoints for pid %u...", proc->pid);
324 if (proc->breakpoints) {
325 dict_apply_to_all(proc->breakpoints, enable_bp_cb,
326 proc);
327 }
Juan Cespedes5e01f651998-03-08 22:31:44 +0100328}
329
Juan Cespedesf1350522008-12-16 18:19:58 +0100330static void
Petr Machatafed1e8d2012-02-07 02:06:29 +0100331disable_bp_cb(void *addr, void *sbp, void *proc)
332{
Juan Cespedescd8976d2009-05-14 13:47:58 +0200333 debug(DEBUG_FUNCTION, "disable_bp_cb(pid=%d)", ((Process *)proc)->pid);
Petr Machatabc373262012-02-07 23:31:15 +0100334 if (((struct breakpoint *)sbp)->enabled)
Petr Machataf789c9c2011-07-09 10:54:27 +0200335 disable_breakpoint(proc, sbp);
Juan Cespedes5b3ffdf2001-07-02 00:52:45 +0200336}
337
Juan Cespedesf1350522008-12-16 18:19:58 +0100338void
Juan Cespedesa8909f72009-04-28 20:02:41 +0200339disable_all_breakpoints(Process *proc) {
Juan Cespedescd8976d2009-05-14 13:47:58 +0200340 debug(DEBUG_FUNCTION, "disable_all_breakpoints(pid=%d)", proc->pid);
Petr Machata9a5420c2011-07-09 11:21:23 +0200341 assert(proc->leader == proc);
Petr Machata61196a42012-02-07 16:41:03 +0100342 dict_apply_to_all(proc->breakpoints, disable_bp_cb, proc);
Juan Cespedes5e01f651998-03-08 22:31:44 +0100343}
Juan Cespedes7186e2a2003-01-31 19:56:34 +0100344
Petr Machatad09d2402012-04-13 21:34:08 +0200345/* XXX This is not currently properly supported. On clone, this is
346 * just sliced. Hopefully at the point that clone is done, this
347 * breakpoint is not necessary anymore. If this use case ends up
348 * being important, we need to add a clone and destroy callbacks to
349 * breakpoints, and we should also probably drop arch_breakpoint_data
350 * so that we don't end up with two different customization mechanisms
351 * for one structure. */
Petr Machata52dbfb12012-03-29 16:38:26 +0200352struct entry_breakpoint {
353 struct breakpoint super;
Petr Machatabac2da52012-05-29 00:42:59 +0200354 arch_addr_t dyn_addr;
Petr Machata52dbfb12012-03-29 16:38:26 +0200355};
356
Petr Machata02648a12012-02-07 13:44:54 +0100357static void
Petr Machata12affff2012-03-29 18:33:03 +0200358entry_breakpoint_on_hit(struct breakpoint *a, struct Process *proc)
Petr Machata02648a12012-02-07 13:44:54 +0100359{
Petr Machata52dbfb12012-03-29 16:38:26 +0200360 struct entry_breakpoint *bp = (void *)a;
Petr Machata02648a12012-02-07 13:44:54 +0100361 if (proc == NULL || proc->leader == NULL)
362 return;
Petr Machatabac2da52012-05-29 00:42:59 +0200363 arch_addr_t dyn_addr = bp->dyn_addr;
Petr Machata3fd099b2012-04-03 02:25:42 +0200364 delete_breakpoint(proc, bp->super.addr);
Petr Machata5ee36822012-04-19 17:01:51 +0200365 linkmap_init(proc, dyn_addr);
Petr Machata93d95df2012-04-17 05:16:19 +0200366 arch_dynlink_done(proc);
Petr Machata52dbfb12012-03-29 16:38:26 +0200367}
368
369int
370entry_breakpoint_init(struct Process *proc,
Petr Machatabac2da52012-05-29 00:42:59 +0200371 struct entry_breakpoint *bp, arch_addr_t addr,
Petr Machata9a04d0e2012-03-29 16:50:38 +0200372 struct library *lib)
Petr Machata52dbfb12012-03-29 16:38:26 +0200373{
374 int err;
375 if ((err = breakpoint_init(&bp->super, proc, addr, NULL)) < 0)
376 return err;
377
378 static struct bp_callbacks entry_callbacks = {
Petr Machata12affff2012-03-29 18:33:03 +0200379 .on_hit = entry_breakpoint_on_hit,
Petr Machata52dbfb12012-03-29 16:38:26 +0200380 };
381 bp->super.cbs = &entry_callbacks;
Petr Machata9a04d0e2012-03-29 16:50:38 +0200382 bp->dyn_addr = lib->dyn_addr;
Petr Machata52dbfb12012-03-29 16:38:26 +0200383 return 0;
Petr Machata02648a12012-02-07 13:44:54 +0100384}
385
Petr Machata1974dbc2011-08-19 18:58:01 +0200386int
Petr Machata75934ad2012-04-14 02:28:03 +0200387breakpoints_init(Process *proc)
Petr Machatac7585b62011-07-08 22:58:12 +0200388{
Juan Cespedescd8976d2009-05-14 13:47:58 +0200389 debug(DEBUG_FUNCTION, "breakpoints_init(pid=%d)", proc->pid);
Petr Machata26627682011-07-08 18:15:32 +0200390
Petr Machata2b46cfc2012-02-18 11:17:29 +0100391 /* XXX breakpoint dictionary should be initialized
392 * outside. Here we just put in breakpoints. */
393 assert(proc->breakpoints != NULL);
394
395 /* Only the thread group leader should hold the breakpoints. */
Petr Machata9a5420c2011-07-09 11:21:23 +0200396 assert(proc->leader == proc);
397
Petr Machata807cdd82012-04-05 02:08:25 +0200398 /* N.B. the following used to be conditional on this, and
399 * maybe it still needs to be. */
400 assert(proc->filename != NULL);
401
402 struct library *lib = ltelf_read_main_binary(proc, proc->filename);
403 struct entry_breakpoint *entry_bp = NULL;
404 int bp_state = 0;
405 int result = -1;
406 switch (lib != NULL) {
407 fail:
Petr Machata807cdd82012-04-05 02:08:25 +0200408 switch (bp_state) {
409 case 2:
Petr Machataa2416362012-04-06 02:43:34 +0200410 proc_remove_library(proc, lib);
Petr Machata807cdd82012-04-05 02:08:25 +0200411 proc_remove_breakpoint(proc, &entry_bp->super);
412 case 1:
413 breakpoint_destroy(&entry_bp->super);
Petr Machata1974dbc2011-08-19 18:58:01 +0200414 }
Petr Machataa2416362012-04-06 02:43:34 +0200415 library_destroy(lib);
Petr Machata807cdd82012-04-05 02:08:25 +0200416 free(entry_bp);
417 case 0:
418 return result;
Petr Machata02648a12012-02-07 13:44:54 +0100419 }
420
Petr Machata807cdd82012-04-05 02:08:25 +0200421 entry_bp = malloc(sizeof(*entry_bp));
422 if (entry_bp == NULL
Petr Machata91c399c2012-05-15 12:17:51 +0200423 || (entry_breakpoint_init(proc, entry_bp,
424 lib->entry, lib)) < 0) {
425 fprintf(stderr,
426 "Couldn't initialize entry breakpoint for PID %d.\n"
427 "Some tracing events may be missed.\n", proc->pid);
428 free(entry_bp);
Petr Machata00928202012-04-07 01:14:24 +0200429
Petr Machata91c399c2012-05-15 12:17:51 +0200430 } else {
431 ++bp_state;
Petr Machata00928202012-04-07 01:14:24 +0200432
Petr Machata91c399c2012-05-15 12:17:51 +0200433 if ((result = proc_add_breakpoint(proc, &entry_bp->super)) < 0)
434 goto fail;
435 ++bp_state;
436
437 if ((result = breakpoint_turn_on(&entry_bp->super, proc)) < 0)
438 goto fail;
439 }
Petr Machataa2416362012-04-06 02:43:34 +0200440 proc_add_library(proc, lib);
441
Juan Cespedes7186e2a2003-01-31 19:56:34 +0100442 proc->callstack_depth = 0;
Petr Machata1974dbc2011-08-19 18:58:01 +0200443 return 0;
Juan Cespedes7186e2a2003-01-31 19:56:34 +0100444}