| Juan Cespedes | d44c6b8 | 1998-09-25 14:48:42 +0200 | [diff] [blame] | 1 | #include "config.h" |
| Juan Cespedes | d44c6b8 | 1998-09-25 14:48:42 +0200 | [diff] [blame] | 2 | |
| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 3 | #define _GNU_SOURCE 1 |
| Juan Cespedes | 1cd999a | 2001-07-03 00:46:04 +0200 | [diff] [blame] | 4 | #include <stdlib.h> |
| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 5 | #include <sys/types.h> |
| 6 | #include <sys/wait.h> |
| 7 | #include <errno.h> |
| 8 | #include <signal.h> |
| 9 | #include <string.h> |
| Juan Cespedes | 1e58313 | 2009-04-07 18:17:11 +0200 | [diff] [blame] | 10 | #include <sys/ptrace.h> |
| Petr Machata | 69a03e6 | 2011-07-09 11:29:12 +0200 | [diff] [blame] | 11 | #include <assert.h> |
| Petr Machata | 97b2084 | 2011-11-22 16:50:36 +0100 | [diff] [blame^] | 12 | #include <unistd.h> |
| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 13 | |
| Juan Cespedes | f728123 | 2009-06-25 16:11:21 +0200 | [diff] [blame] | 14 | #include "common.h" |
| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 15 | |
| Juan Cespedes | 393f1d0 | 2009-05-07 11:13:54 +0200 | [diff] [blame] | 16 | static Event event; |
| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 17 | |
| Petr Machata | 69a03e6 | 2011-07-09 11:29:12 +0200 | [diff] [blame] | 18 | /* A queue of events that we missed while enabling the |
| 19 | * breakpoint in one of tasks. */ |
| 20 | static Event * delayed_events = NULL; |
| 21 | static Event * end_delayed_events = NULL; |
| 22 | |
| Petr Machata | cebb884 | 2011-07-09 11:14:11 +0200 | [diff] [blame] | 23 | static enum pcb_status |
| 24 | first (Process * proc, void * data) |
| 25 | { |
| 26 | return pcb_stop; |
| 27 | } |
| 28 | |
| Petr Machata | 69a03e6 | 2011-07-09 11:29:12 +0200 | [diff] [blame] | 29 | void |
| 30 | enque_event(Event * event) |
| 31 | { |
| 32 | debug(DEBUG_FUNCTION, "%d: queuing event %d for later", |
| 33 | event->proc->pid, event->type); |
| 34 | Event * ne = malloc(sizeof(*ne)); |
| 35 | if (ne == NULL) { |
| 36 | perror("event will be missed: malloc"); |
| 37 | return; |
| 38 | } |
| 39 | |
| 40 | *ne = *event; |
| 41 | ne->next = NULL; |
| 42 | if (end_delayed_events == NULL) { |
| 43 | assert(delayed_events == NULL); |
| 44 | end_delayed_events = delayed_events = ne; |
| 45 | } |
| 46 | else { |
| 47 | assert(delayed_events != NULL); |
| 48 | end_delayed_events = end_delayed_events->next = ne; |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | Event * |
| 53 | each_qd_event(enum ecb_status (*pred)(Event *, void *), void * data) |
| 54 | { |
| 55 | Event * prev = delayed_events; |
| 56 | Event * event; |
| 57 | for (event = prev; event != NULL; ) { |
| 58 | switch ((*pred)(event, data)) { |
| 59 | case ecb_cont: |
| 60 | prev = event; |
| 61 | event = event->next; |
| 62 | continue; |
| 63 | |
| 64 | case ecb_deque: |
| 65 | debug(DEBUG_FUNCTION, "dequeuing event %d for %d", |
| 66 | event->type, |
| 67 | event->proc != NULL ? event->proc->pid : -1); |
| 68 | /* |
| 69 | printf("dequeuing event %d for %d\n", event->type, |
| 70 | event->proc != NULL ? event->proc->pid : -1) ; |
| 71 | */ |
| 72 | if (end_delayed_events == event) |
| 73 | end_delayed_events = prev; |
| 74 | if (delayed_events == event) |
| 75 | delayed_events = event->next; |
| 76 | else |
| 77 | prev->next = event->next; |
| 78 | if (delayed_events == NULL) |
| 79 | end_delayed_events = NULL; |
| 80 | /* fall-through */ |
| 81 | |
| 82 | case ecb_yield: |
| 83 | return event; |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | return NULL; |
| 88 | } |
| 89 | |
| 90 | static enum ecb_status |
| 91 | event_process_not_reenabling(Event * event, void * data) |
| 92 | { |
| Petr Machata | 4007d74 | 2011-07-09 11:29:42 +0200 | [diff] [blame] | 93 | if (event->proc == NULL |
| 94 | || event->proc->leader == NULL |
| 95 | || event->proc->leader->event_handler == NULL) |
| 96 | return ecb_deque; |
| 97 | else |
| 98 | return ecb_cont; |
| Petr Machata | 69a03e6 | 2011-07-09 11:29:12 +0200 | [diff] [blame] | 99 | } |
| 100 | |
| 101 | static Event * |
| 102 | next_qd_event(void) |
| 103 | { |
| 104 | return each_qd_event(&event_process_not_reenabling, NULL); |
| 105 | } |
| 106 | |
| Juan Cespedes | 393f1d0 | 2009-05-07 11:13:54 +0200 | [diff] [blame] | 107 | Event * |
| Petr Machata | 2662768 | 2011-07-08 18:15:32 +0200 | [diff] [blame] | 108 | next_event(void) |
| 109 | { |
| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 110 | pid_t pid; |
| 111 | int status; |
| 112 | int tmp; |
| Petr Machata | ef46b3e | 2007-05-09 19:21:42 +0200 | [diff] [blame] | 113 | int stop_signal; |
| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 114 | |
| Juan Cespedes | cd8976d | 2009-05-14 13:47:58 +0200 | [diff] [blame] | 115 | debug(DEBUG_FUNCTION, "next_event()"); |
| Petr Machata | 69a03e6 | 2011-07-09 11:29:12 +0200 | [diff] [blame] | 116 | Event * ev; |
| 117 | if ((ev = next_qd_event()) != NULL) { |
| 118 | event = *ev; |
| 119 | free(ev); |
| 120 | return &event; |
| 121 | } |
| 122 | |
| Petr Machata | cebb884 | 2011-07-09 11:14:11 +0200 | [diff] [blame] | 123 | if (!each_process(NULL, &first, NULL)) { |
| Juan Cespedes | cd8976d | 2009-05-14 13:47:58 +0200 | [diff] [blame] | 124 | debug(DEBUG_EVENT, "event: No more traced programs: exiting"); |
| Juan Cespedes | 28f6019 | 1998-04-12 00:04:39 +0200 | [diff] [blame] | 125 | exit(0); |
| 126 | } |
| Juan Cespedes | 6be8028 | 2009-05-28 19:06:00 +0200 | [diff] [blame] | 127 | pid = waitpid(-1, &status, __WALL); |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 128 | if (pid == -1) { |
| 129 | if (errno == ECHILD) { |
| Juan Cespedes | cd8976d | 2009-05-14 13:47:58 +0200 | [diff] [blame] | 130 | debug(DEBUG_EVENT, "event: No more traced programs: exiting"); |
| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 131 | exit(0); |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 132 | } else if (errno == EINTR) { |
| Juan Cespedes | cd8976d | 2009-05-14 13:47:58 +0200 | [diff] [blame] | 133 | debug(DEBUG_EVENT, "event: none (wait received EINTR?)"); |
| Juan Cespedes | 8f6d1ec | 2009-05-07 17:50:34 +0200 | [diff] [blame] | 134 | event.type = EVENT_NONE; |
| Juan Cespedes | 28f6019 | 1998-04-12 00:04:39 +0200 | [diff] [blame] | 135 | return &event; |
| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 136 | } |
| 137 | perror("wait"); |
| 138 | exit(1); |
| 139 | } |
| 140 | event.proc = pid2proc(pid); |
| Juan Cespedes | 2721e6a | 2009-05-21 15:15:40 +0200 | [diff] [blame] | 141 | if (!event.proc || event.proc->state == STATE_BEING_CREATED) { |
| Petr Machata | 97b2084 | 2011-11-22 16:50:36 +0100 | [diff] [blame^] | 142 | /* Work around (presumably) a bug on some kernels, |
| 143 | * where we are seeing a waitpid event even though the |
| 144 | * process is still reported to be running. Wait for |
| 145 | * the tracing stop to propagate. But don't get stuck |
| 146 | * here forever. |
| 147 | * |
| 148 | * We need the process in T, because there's a lot of |
| 149 | * ptracing going on all over the place, and these |
| 150 | * calls fail when the process is not in T. |
| 151 | * |
| 152 | * N.B. This was observed on RHEL 5 Itanium, but I'm |
| 153 | * turning this on globally, to save some poor soul |
| 154 | * down the road (which could well be me a year from |
| 155 | * now) the pain of figuring this out all over again. |
| 156 | * Petr Machata 2011-11-22. */ |
| 157 | int i = 0; |
| 158 | for (; i < 100 && process_status(pid) != ps_tracing_stop; ++i) { |
| 159 | debug(2, "waiting for %d to stop", pid); |
| 160 | usleep(10000); |
| 161 | } |
| Juan Cespedes | 8f6d1ec | 2009-05-07 17:50:34 +0200 | [diff] [blame] | 162 | event.type = EVENT_NEW; |
| Juan Cespedes | 2721e6a | 2009-05-21 15:15:40 +0200 | [diff] [blame] | 163 | event.e_un.newpid = pid; |
| Juan Cespedes | cd8976d | 2009-05-14 13:47:58 +0200 | [diff] [blame] | 164 | debug(DEBUG_EVENT, "event: NEW: pid=%d", pid); |
| Juan Cespedes | a8909f7 | 2009-04-28 20:02:41 +0200 | [diff] [blame] | 165 | return &event; |
| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 166 | } |
| Juan Cespedes | 5c3fe06 | 2004-06-14 18:08:37 +0200 | [diff] [blame] | 167 | get_arch_dep(event.proc); |
| Juan Cespedes | 1e58313 | 2009-04-07 18:17:11 +0200 | [diff] [blame] | 168 | debug(3, "event from pid %u", pid); |
| Petr Machata | 9a5420c | 2011-07-09 11:21:23 +0200 | [diff] [blame] | 169 | if (event.proc->breakpoints_enabled == -1) |
| Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 170 | trace_set_options(event.proc, event.proc->pid); |
| Petr Machata | 9a5420c | 2011-07-09 11:21:23 +0200 | [diff] [blame] | 171 | Process *leader = event.proc->leader; |
| 172 | if (leader == event.proc) { |
| 173 | if (event.proc->breakpoints_enabled == -1) { |
| 174 | event.type = EVENT_NONE; |
| 175 | enable_all_breakpoints(event.proc); |
| 176 | continue_process(event.proc->pid); |
| 177 | debug(DEBUG_EVENT, |
| 178 | "event: NONE: pid=%d (enabling breakpoints)", |
| 179 | pid); |
| 180 | return &event; |
| 181 | } else if (!event.proc->libdl_hooked) { |
| 182 | /* debug struct may not have been written yet.. */ |
| 183 | if (linkmap_init(event.proc, &main_lte) == 0) { |
| 184 | event.proc->libdl_hooked = 1; |
| 185 | } |
| Joe Damato | f0bd98b | 2010-11-08 15:47:42 -0800 | [diff] [blame] | 186 | } |
| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 187 | } |
| Joe Damato | f0bd98b | 2010-11-08 15:47:42 -0800 | [diff] [blame] | 188 | |
| Petr Machata | f2d2ba5 | 2011-07-09 11:03:26 +0200 | [diff] [blame] | 189 | /* The process should be stopped after the waitpid call. But |
| 190 | * when the whole thread group is terminated, we see |
| 191 | * individual tasks spontaneously transitioning from 't' to |
| 192 | * 'R' and 'Z'. Calls to ptrace fail and /proc/pid/status may |
| 193 | * not even be available anymore, so we can't check in |
| 194 | * advance. So we just drop the error checking around ptrace |
| 195 | * calls. We check for termination ex post when it fails, |
| 196 | * suppress the event, and let the event loop collect the |
| 197 | * termination in the next iteration. */ |
| 198 | #define CHECK_PROCESS_TERMINATED \ |
| 199 | do { \ |
| 200 | int errno_save = errno; \ |
| 201 | switch (process_stopped(pid)) \ |
| 202 | case 0: \ |
| 203 | case -1: { \ |
| 204 | debug(DEBUG_EVENT, \ |
| 205 | "process not stopped, is it terminating?"); \ |
| 206 | event.type = EVENT_NONE; \ |
| 207 | continue_process(event.proc->pid); \ |
| 208 | return &event; \ |
| 209 | } \ |
| 210 | errno = errno_save; \ |
| 211 | } while (0) |
| 212 | |
| Petr Machata | 9a5420c | 2011-07-09 11:21:23 +0200 | [diff] [blame] | 213 | event.proc->instruction_pointer = (void *)(uintptr_t)-1; |
| Petr Machata | 6901b7e | 2011-07-09 11:00:33 +0200 | [diff] [blame] | 214 | |
| Petr Machata | f2d2ba5 | 2011-07-09 11:03:26 +0200 | [diff] [blame] | 215 | /* Check for task termination now, before we have a need to |
| 216 | * call CHECK_PROCESS_TERMINATED later. That would suppress |
| 217 | * the event that we are processing. */ |
| 218 | if (WIFSIGNALED(status)) { |
| 219 | event.type = EVENT_EXIT_SIGNAL; |
| 220 | event.e_un.signum = WTERMSIG(status); |
| 221 | debug(DEBUG_EVENT, "event: EXIT_SIGNAL: pid=%d, signum=%d", pid, event.e_un.signum); |
| 222 | return &event; |
| 223 | } |
| 224 | if (WIFEXITED(status)) { |
| 225 | event.type = EVENT_EXIT; |
| 226 | event.e_un.ret_val = WEXITSTATUS(status); |
| 227 | debug(DEBUG_EVENT, "event: EXIT: pid=%d, status=%d", pid, event.e_un.ret_val); |
| 228 | return &event; |
| 229 | } |
| 230 | |
| Petr Machata | 6901b7e | 2011-07-09 11:00:33 +0200 | [diff] [blame] | 231 | event.proc->instruction_pointer = get_instruction_pointer(event.proc); |
| 232 | if (event.proc->instruction_pointer == (void *)(uintptr_t)-1) { |
| Petr Machata | f2d2ba5 | 2011-07-09 11:03:26 +0200 | [diff] [blame] | 233 | CHECK_PROCESS_TERMINATED; |
| Petr Machata | 6901b7e | 2011-07-09 11:00:33 +0200 | [diff] [blame] | 234 | if (errno != 0) |
| 235 | perror("get_instruction_pointer"); |
| Juan Cespedes | f0fdae9 | 1998-03-11 00:03:00 +0100 | [diff] [blame] | 236 | } |
| Petr Machata | 6901b7e | 2011-07-09 11:00:33 +0200 | [diff] [blame] | 237 | |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 238 | switch (syscall_p(event.proc, status, &tmp)) { |
| Juan Cespedes | 63184be | 2008-12-10 13:30:12 +0100 | [diff] [blame] | 239 | case 1: |
| Juan Cespedes | 8f6d1ec | 2009-05-07 17:50:34 +0200 | [diff] [blame] | 240 | event.type = EVENT_SYSCALL; |
| Juan Cespedes | 63184be | 2008-12-10 13:30:12 +0100 | [diff] [blame] | 241 | event.e_un.sysnum = tmp; |
| Juan Cespedes | cd8976d | 2009-05-14 13:47:58 +0200 | [diff] [blame] | 242 | debug(DEBUG_EVENT, "event: SYSCALL: pid=%d, sysnum=%d", pid, tmp); |
| Juan Cespedes | 63184be | 2008-12-10 13:30:12 +0100 | [diff] [blame] | 243 | return &event; |
| 244 | case 2: |
| Juan Cespedes | 8f6d1ec | 2009-05-07 17:50:34 +0200 | [diff] [blame] | 245 | event.type = EVENT_SYSRET; |
| Juan Cespedes | 63184be | 2008-12-10 13:30:12 +0100 | [diff] [blame] | 246 | event.e_un.sysnum = tmp; |
| Juan Cespedes | cd8976d | 2009-05-14 13:47:58 +0200 | [diff] [blame] | 247 | debug(DEBUG_EVENT, "event: SYSRET: pid=%d, sysnum=%d", pid, tmp); |
| Juan Cespedes | 63184be | 2008-12-10 13:30:12 +0100 | [diff] [blame] | 248 | return &event; |
| 249 | case 3: |
| Juan Cespedes | 8f6d1ec | 2009-05-07 17:50:34 +0200 | [diff] [blame] | 250 | event.type = EVENT_ARCH_SYSCALL; |
| Juan Cespedes | 63184be | 2008-12-10 13:30:12 +0100 | [diff] [blame] | 251 | event.e_un.sysnum = tmp; |
| Juan Cespedes | cd8976d | 2009-05-14 13:47:58 +0200 | [diff] [blame] | 252 | debug(DEBUG_EVENT, "event: ARCH_SYSCALL: pid=%d, sysnum=%d", pid, tmp); |
| Juan Cespedes | 63184be | 2008-12-10 13:30:12 +0100 | [diff] [blame] | 253 | return &event; |
| 254 | case 4: |
| Juan Cespedes | 8f6d1ec | 2009-05-07 17:50:34 +0200 | [diff] [blame] | 255 | event.type = EVENT_ARCH_SYSRET; |
| Juan Cespedes | 63184be | 2008-12-10 13:30:12 +0100 | [diff] [blame] | 256 | event.e_un.sysnum = tmp; |
| Juan Cespedes | cd8976d | 2009-05-14 13:47:58 +0200 | [diff] [blame] | 257 | debug(DEBUG_EVENT, "event: ARCH_SYSRET: pid=%d, sysnum=%d", pid, tmp); |
| Juan Cespedes | 63184be | 2008-12-10 13:30:12 +0100 | [diff] [blame] | 258 | return &event; |
| 259 | case -1: |
| Petr Machata | f2d2ba5 | 2011-07-09 11:03:26 +0200 | [diff] [blame] | 260 | CHECK_PROCESS_TERMINATED; |
| 261 | if (errno != 0) |
| 262 | perror("syscall_p"); |
| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 263 | } |
| Petr Machata | cbe29c6 | 2011-09-27 02:27:58 +0200 | [diff] [blame] | 264 | if (WIFSTOPPED(status)) { |
| 265 | int what = status >> 16; |
| 266 | if (what == PTRACE_EVENT_VFORK |
| 267 | || what == PTRACE_EVENT_FORK |
| 268 | || what == PTRACE_EVENT_CLONE) { |
| 269 | unsigned long data; |
| 270 | event.type = what == PTRACE_EVENT_VFORK |
| 271 | ? EVENT_VFORK : EVENT_CLONE; |
| 272 | ptrace(PTRACE_GETEVENTMSG, pid, NULL, &data); |
| 273 | event.e_un.newpid = data; |
| 274 | debug(DEBUG_EVENT, "event: CLONE: pid=%d, newpid=%d", |
| 275 | pid, (int)data); |
| 276 | return &event; |
| 277 | } |
| Juan Cespedes | 1e58313 | 2009-04-07 18:17:11 +0200 | [diff] [blame] | 278 | } |
| Juan Cespedes | 1e58313 | 2009-04-07 18:17:11 +0200 | [diff] [blame] | 279 | if (WIFSTOPPED(status) && (status>>16 == PTRACE_EVENT_EXEC)) { |
| Juan Cespedes | 8f6d1ec | 2009-05-07 17:50:34 +0200 | [diff] [blame] | 280 | event.type = EVENT_EXEC; |
| Juan Cespedes | cd8976d | 2009-05-14 13:47:58 +0200 | [diff] [blame] | 281 | debug(DEBUG_EVENT, "event: EXEC: pid=%d", pid); |
| Juan Cespedes | 1e58313 | 2009-04-07 18:17:11 +0200 | [diff] [blame] | 282 | return &event; |
| 283 | } |
| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 284 | if (!WIFSTOPPED(status)) { |
| Juan Cespedes | 427b781 | 2009-07-06 23:05:30 +0200 | [diff] [blame] | 285 | /* should never happen */ |
| Juan Cespedes | 8f6d1ec | 2009-05-07 17:50:34 +0200 | [diff] [blame] | 286 | event.type = EVENT_NONE; |
| Juan Cespedes | cd8976d | 2009-05-14 13:47:58 +0200 | [diff] [blame] | 287 | debug(DEBUG_EVENT, "event: NONE: pid=%d (wait error?)", pid); |
| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 288 | return &event; |
| 289 | } |
| Petr Machata | ef46b3e | 2007-05-09 19:21:42 +0200 | [diff] [blame] | 290 | |
| 291 | stop_signal = WSTOPSIG(status); |
| 292 | |
| 293 | /* On some targets, breakpoints are signalled not using |
| Petr Machata | 6901b7e | 2011-07-09 11:00:33 +0200 | [diff] [blame] | 294 | SIGTRAP, but also with SIGILL, SIGSEGV or SIGEMT. SIGEMT |
| 295 | is not defined on Linux, but check for the others. |
| Petr Machata | ef46b3e | 2007-05-09 19:21:42 +0200 | [diff] [blame] | 296 | |
| Petr Machata | 6901b7e | 2011-07-09 11:00:33 +0200 | [diff] [blame] | 297 | N.B. see comments in GDB's infrun.c for details. I've |
| 298 | actually seen this on an Itanium machine on RHEL 5, I don't |
| 299 | remember the exact kernel version anymore. ia64-sigill.s |
| 300 | in the test suite tests this. Petr Machata 2011-06-08. */ |
| 301 | void * break_address |
| 302 | = event.proc->instruction_pointer - DECR_PC_AFTER_BREAK; |
| 303 | if ((stop_signal == SIGSEGV || stop_signal == SIGILL) |
| Petr Machata | 9a5420c | 2011-07-09 11:21:23 +0200 | [diff] [blame] | 304 | && leader != NULL |
| 305 | && address2bpstruct(leader, break_address)) |
| Petr Machata | ef46b3e | 2007-05-09 19:21:42 +0200 | [diff] [blame] | 306 | stop_signal = SIGTRAP; |
| Petr Machata | ef46b3e | 2007-05-09 19:21:42 +0200 | [diff] [blame] | 307 | |
| 308 | if (stop_signal != (SIGTRAP | event.proc->tracesysgood) |
| Juan Cespedes | 427b781 | 2009-07-06 23:05:30 +0200 | [diff] [blame] | 309 | && stop_signal != SIGTRAP) { |
| Juan Cespedes | 8f6d1ec | 2009-05-07 17:50:34 +0200 | [diff] [blame] | 310 | event.type = EVENT_SIGNAL; |
| Juan Cespedes | a413e5b | 2007-09-04 17:34:53 +0200 | [diff] [blame] | 311 | event.e_un.signum = stop_signal; |
| Juan Cespedes | cd8976d | 2009-05-14 13:47:58 +0200 | [diff] [blame] | 312 | debug(DEBUG_EVENT, "event: SIGNAL: pid=%d, signum=%d", pid, stop_signal); |
| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 313 | return &event; |
| 314 | } |
| Petr Machata | 55ed83b | 2007-05-17 16:24:15 +0200 | [diff] [blame] | 315 | |
| Juan Cespedes | 427b781 | 2009-07-06 23:05:30 +0200 | [diff] [blame] | 316 | /* last case [by exhaustion] */ |
| Juan Cespedes | 8f6d1ec | 2009-05-07 17:50:34 +0200 | [diff] [blame] | 317 | event.type = EVENT_BREAKPOINT; |
| Juan Cespedes | 427b781 | 2009-07-06 23:05:30 +0200 | [diff] [blame] | 318 | |
| Petr Machata | 6901b7e | 2011-07-09 11:00:33 +0200 | [diff] [blame] | 319 | event.e_un.brk_addr = break_address; |
| Juan Cespedes | cd8976d | 2009-05-14 13:47:58 +0200 | [diff] [blame] | 320 | debug(DEBUG_EVENT, "event: BREAKPOINT: pid=%d, addr=%p", pid, event.e_un.brk_addr); |
| Petr Machata | 6901b7e | 2011-07-09 11:00:33 +0200 | [diff] [blame] | 321 | |
| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 322 | return &event; |
| 323 | } |