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