diff options
author | Petr Machata <pmachata@redhat.com> | 2012-04-19 17:00:53 +0200 |
---|---|---|
committer | Petr Machata <pmachata@redhat.com> | 2012-04-19 17:00:53 +0200 |
commit | f7fee43f72667f453bba5aaeea6b5490ece6792a (patch) | |
tree | a4753481a80b5e5cefba34e1613df6a4922f3afc /proc.c | |
parent | 77fbb8ff4ba461c11af3678a0db7cf6a47738ff4 (diff) | |
download | ltrace-f7fee43f72667f453bba5aaeea6b5490ece6792a.tar.gz |
Implement proc_remove_breakpoint
Diffstat (limited to 'proc.c')
-rw-r--r-- | proc.c | 19 |
1 files changed, 13 insertions, 6 deletions
@@ -680,17 +680,22 @@ proc_each_library(struct Process *proc, struct library *it, return NULL; } -int -proc_add_breakpoint(struct Process *proc, struct breakpoint *bp) +static void +check_leader(struct Process *proc) { /* Only the group leader should be getting the breakpoints and * thus have ->breakpoint initialized. */ assert(proc->leader != NULL); assert(proc->leader == proc); assert(proc->breakpoints != NULL); +} +int +proc_add_breakpoint(struct Process *proc, struct breakpoint *bp) +{ debug(DEBUG_FUNCTION, "proc_add_breakpoint(pid=%d, %s@%p)", proc->pid, breakpoint_name(bp), bp->addr); + check_leader(proc); /* XXX We might merge bp->libsym instead of the following * assert, but that's not necessary right now. Read the @@ -706,12 +711,14 @@ proc_add_breakpoint(struct Process *proc, struct breakpoint *bp) return 0; } -int +void proc_remove_breakpoint(struct Process *proc, struct breakpoint *bp) { - /* XXX We can't, really. We are missing dict_remove. */ - assert(!"Not yet implemented!"); - abort(); + debug(DEBUG_FUNCTION, "proc_remove_breakpoint(pid=%d, %s@%p)", + proc->pid, breakpoint_name(bp), bp->addr); + check_leader(proc); + struct breakpoint *removed = dict_remove(proc->breakpoints, bp->addr); + assert(removed == bp); } /* Dict doesn't support iteration restarts, so here's this contraption |