| Juan Cespedes | d44c6b8 | 1998-09-25 14:48:42 +0200 | [diff] [blame] | 1 | #if HAVE_CONFIG_H |
| 2 | #include "config.h" |
| 3 | #endif |
| 4 | |
| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 5 | #define _GNU_SOURCE |
| 6 | #include <stdio.h> |
| 7 | #include <string.h> |
| Juan Cespedes | 1fe93d5 | 1998-03-13 00:29:21 +0100 | [diff] [blame] | 8 | #include <stdlib.h> |
| Juan Cespedes | 28f6019 | 1998-04-12 00:04:39 +0200 | [diff] [blame] | 9 | #include <signal.h> |
| Juan Cespedes | 5b3ffdf | 2001-07-02 00:52:45 +0200 | [diff] [blame] | 10 | #include <assert.h> |
| Juan Cespedes | d65efa3 | 2003-02-03 00:22:30 +0100 | [diff] [blame] | 11 | #include <sys/time.h> |
| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 12 | |
| 13 | #include "ltrace.h" |
| 14 | #include "output.h" |
| 15 | #include "options.h" |
| Juan Cespedes | 81690ef | 1998-03-13 19:31:29 +0100 | [diff] [blame] | 16 | #include "elf.h" |
| Juan Cespedes | cac15c3 | 2003-01-31 18:58:58 +0100 | [diff] [blame] | 17 | #include "debug.h" |
| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 18 | |
| Juan Cespedes | f1bfe20 | 2002-03-27 00:22:23 +0100 | [diff] [blame] | 19 | #ifdef __powerpc__ |
| 20 | #include <sys/ptrace.h> |
| 21 | #endif |
| 22 | |
| Juan Cespedes | 393f1d0 | 2009-05-07 11:13:54 +0200 | [diff] [blame^] | 23 | static void process_signal(Event *event); |
| 24 | static void process_exit(Event *event); |
| 25 | static void process_exit_signal(Event *event); |
| 26 | static void process_syscall(Event *event); |
| 27 | static void process_arch_syscall(Event *event); |
| 28 | static void process_sysret(Event *event); |
| 29 | static void process_arch_sysret(Event *event); |
| 30 | static void process_fork(Event *event); |
| 31 | static void process_clone(Event *event); |
| 32 | static void process_exec(Event *event); |
| 33 | static void process_breakpoint(Event *event); |
| Juan Cespedes | a8909f7 | 2009-04-28 20:02:41 +0200 | [diff] [blame] | 34 | static void remove_proc(Process *proc); |
| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 35 | |
| Juan Cespedes | a8909f7 | 2009-04-28 20:02:41 +0200 | [diff] [blame] | 36 | static void callstack_push_syscall(Process *proc, int sysnum); |
| 37 | static void callstack_push_symfunc(Process *proc, |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 38 | struct library_symbol *sym); |
| Juan Cespedes | a8909f7 | 2009-04-28 20:02:41 +0200 | [diff] [blame] | 39 | static void callstack_pop(Process *proc); |
| Juan Cespedes | 5b3ffdf | 2001-07-02 00:52:45 +0200 | [diff] [blame] | 40 | |
| Juan Cespedes | f135052 | 2008-12-16 18:19:58 +0100 | [diff] [blame] | 41 | static char * |
| Juan Cespedes | a8909f7 | 2009-04-28 20:02:41 +0200 | [diff] [blame] | 42 | shortsignal(Process *proc, int signum) { |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 43 | static char *signalent0[] = { |
| 44 | #include "signalent.h" |
| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 45 | }; |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 46 | static char *signalent1[] = { |
| 47 | #include "signalent1.h" |
| Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 48 | }; |
| 49 | static char **signalents[] = { signalent0, signalent1 }; |
| 50 | int nsignals[] = { sizeof signalent0 / sizeof signalent0[0], |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 51 | sizeof signalent1 / sizeof signalent1[0] |
| 52 | }; |
| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 53 | |
| Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 54 | if (proc->personality > sizeof signalents / sizeof signalents[0]) |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 55 | abort(); |
| Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 56 | if (signum < 0 || signum >= nsignals[proc->personality]) { |
| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 57 | return "UNKNOWN_SIGNAL"; |
| 58 | } else { |
| Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 59 | return signalents[proc->personality][signum]; |
| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 60 | } |
| 61 | } |
| 62 | |
| Juan Cespedes | f135052 | 2008-12-16 18:19:58 +0100 | [diff] [blame] | 63 | static char * |
| Juan Cespedes | a8909f7 | 2009-04-28 20:02:41 +0200 | [diff] [blame] | 64 | sysname(Process *proc, int sysnum) { |
| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 65 | static char result[128]; |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 66 | static char *syscalent0[] = { |
| 67 | #include "syscallent.h" |
| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 68 | }; |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 69 | static char *syscalent1[] = { |
| 70 | #include "syscallent1.h" |
| Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 71 | }; |
| 72 | static char **syscalents[] = { syscalent0, syscalent1 }; |
| 73 | int nsyscals[] = { sizeof syscalent0 / sizeof syscalent0[0], |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 74 | sizeof syscalent1 / sizeof syscalent1[0] |
| 75 | }; |
| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 76 | |
| Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 77 | if (proc->personality > sizeof syscalents / sizeof syscalents[0]) |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 78 | abort(); |
| Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 79 | if (sysnum < 0 || sysnum >= nsyscals[proc->personality]) { |
| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 80 | sprintf(result, "SYS_%d", sysnum); |
| 81 | return result; |
| 82 | } else { |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 83 | sprintf(result, "SYS_%s", |
| 84 | syscalents[proc->personality][sysnum]); |
| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 85 | return result; |
| 86 | } |
| 87 | } |
| 88 | |
| Juan Cespedes | f135052 | 2008-12-16 18:19:58 +0100 | [diff] [blame] | 89 | static char * |
| Juan Cespedes | a8909f7 | 2009-04-28 20:02:41 +0200 | [diff] [blame] | 90 | arch_sysname(Process *proc, int sysnum) { |
| Juan Cespedes | 63184be | 2008-12-10 13:30:12 +0100 | [diff] [blame] | 91 | static char result[128]; |
| 92 | static char *arch_syscalent[] = { |
| 93 | #include "arch_syscallent.h" |
| 94 | }; |
| 95 | int nsyscals = sizeof arch_syscalent / sizeof arch_syscalent[0]; |
| 96 | |
| 97 | if (sysnum < 0 || sysnum >= nsyscals) { |
| 98 | sprintf(result, "ARCH_%d", sysnum); |
| 99 | return result; |
| 100 | } else { |
| 101 | sprintf(result, "ARCH_%s", |
| 102 | arch_syscalent[sysnum]); |
| 103 | return result; |
| 104 | } |
| 105 | } |
| 106 | |
| Juan Cespedes | f135052 | 2008-12-16 18:19:58 +0100 | [diff] [blame] | 107 | void |
| Juan Cespedes | 393f1d0 | 2009-05-07 11:13:54 +0200 | [diff] [blame^] | 108 | process_event(Event *event) { |
| Juan Cespedes | efe85f0 | 2004-04-04 01:31:38 +0200 | [diff] [blame] | 109 | switch (event->thing) { |
| Juan Cespedes | 138d41c | 2009-04-07 00:49:12 +0200 | [diff] [blame] | 110 | case EVENT_NONE: |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 111 | debug(1, "event: none"); |
| 112 | return; |
| Juan Cespedes | 138d41c | 2009-04-07 00:49:12 +0200 | [diff] [blame] | 113 | case EVENT_SIGNAL: |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 114 | debug(1, "event: signal (%s [%d])", |
| 115 | shortsignal(event->proc, event->e_un.signum), |
| 116 | event->e_un.signum); |
| 117 | process_signal(event); |
| 118 | return; |
| Juan Cespedes | 138d41c | 2009-04-07 00:49:12 +0200 | [diff] [blame] | 119 | case EVENT_EXIT: |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 120 | debug(1, "event: exit (%d)", event->e_un.ret_val); |
| 121 | process_exit(event); |
| 122 | return; |
| Juan Cespedes | 138d41c | 2009-04-07 00:49:12 +0200 | [diff] [blame] | 123 | case EVENT_EXIT_SIGNAL: |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 124 | debug(1, "event: exit signal (%s [%d])", |
| 125 | shortsignal(event->proc, event->e_un.signum), |
| 126 | event->e_un.signum); |
| 127 | process_exit_signal(event); |
| 128 | return; |
| Juan Cespedes | 138d41c | 2009-04-07 00:49:12 +0200 | [diff] [blame] | 129 | case EVENT_SYSCALL: |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 130 | debug(1, "event: syscall (%s [%d])", |
| 131 | sysname(event->proc, event->e_un.sysnum), |
| 132 | event->e_un.sysnum); |
| 133 | process_syscall(event); |
| 134 | return; |
| Juan Cespedes | 138d41c | 2009-04-07 00:49:12 +0200 | [diff] [blame] | 135 | case EVENT_SYSRET: |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 136 | debug(1, "event: sysret (%s [%d])", |
| 137 | sysname(event->proc, event->e_un.sysnum), |
| 138 | event->e_un.sysnum); |
| 139 | process_sysret(event); |
| 140 | return; |
| Juan Cespedes | 138d41c | 2009-04-07 00:49:12 +0200 | [diff] [blame] | 141 | case EVENT_ARCH_SYSCALL: |
| Juan Cespedes | 63184be | 2008-12-10 13:30:12 +0100 | [diff] [blame] | 142 | debug(1, "event: arch_syscall (%s [%d])", |
| 143 | arch_sysname(event->proc, event->e_un.sysnum), |
| 144 | event->e_un.sysnum); |
| 145 | process_arch_syscall(event); |
| 146 | return; |
| Juan Cespedes | 138d41c | 2009-04-07 00:49:12 +0200 | [diff] [blame] | 147 | case EVENT_ARCH_SYSRET: |
| Juan Cespedes | 63184be | 2008-12-10 13:30:12 +0100 | [diff] [blame] | 148 | debug(1, "event: arch_sysret (%s [%d])", |
| 149 | arch_sysname(event->proc, event->e_un.sysnum), |
| 150 | event->e_un.sysnum); |
| 151 | process_arch_sysret(event); |
| 152 | return; |
| Juan Cespedes | 1e58313 | 2009-04-07 18:17:11 +0200 | [diff] [blame] | 153 | case EVENT_FORK: |
| 154 | debug(1, "event: fork (%u)", event->e_un.newpid); |
| 155 | process_fork(event); |
| 156 | return; |
| 157 | case EVENT_CLONE: |
| 158 | debug(1, "event: clone (%u)", event->e_un.newpid); |
| 159 | process_clone(event); |
| 160 | return; |
| 161 | case EVENT_EXEC: |
| 162 | debug(1, "event: exec()"); |
| 163 | process_exec(event); |
| 164 | return; |
| Juan Cespedes | 138d41c | 2009-04-07 00:49:12 +0200 | [diff] [blame] | 165 | case EVENT_BREAKPOINT: |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 166 | debug(1, "event: breakpoint"); |
| 167 | process_breakpoint(event); |
| 168 | return; |
| 169 | default: |
| 170 | fprintf(stderr, "Error! unknown event?\n"); |
| 171 | exit(1); |
| Juan Cespedes | efe85f0 | 2004-04-04 01:31:38 +0200 | [diff] [blame] | 172 | } |
| 173 | } |
| 174 | |
| Juan Cespedes | f135052 | 2008-12-16 18:19:58 +0100 | [diff] [blame] | 175 | static void |
| Juan Cespedes | 393f1d0 | 2009-05-07 11:13:54 +0200 | [diff] [blame^] | 176 | process_signal(Event *event) { |
| Juan Cespedes | 28f6019 | 1998-04-12 00:04:39 +0200 | [diff] [blame] | 177 | if (exiting && event->e_un.signum == SIGSTOP) { |
| 178 | pid_t pid = event->proc->pid; |
| 179 | disable_all_breakpoints(event->proc); |
| 180 | untrace_pid(pid); |
| 181 | remove_proc(event->proc); |
| Juan Cespedes | 28f6019 | 1998-04-12 00:04:39 +0200 | [diff] [blame] | 182 | return; |
| 183 | } |
| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 184 | output_line(event->proc, "--- %s (%s) ---", |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 185 | shortsignal(event->proc, event->e_un.signum), |
| 186 | strsignal(event->e_un.signum)); |
| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 187 | continue_after_signal(event->proc->pid, event->e_un.signum); |
| 188 | } |
| 189 | |
| Juan Cespedes | f135052 | 2008-12-16 18:19:58 +0100 | [diff] [blame] | 190 | static void |
| Juan Cespedes | 393f1d0 | 2009-05-07 11:13:54 +0200 | [diff] [blame^] | 191 | process_exit(Event *event) { |
| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 192 | output_line(event->proc, "+++ exited (status %d) +++", |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 193 | event->e_un.ret_val); |
| Juan Cespedes | 1fe93d5 | 1998-03-13 00:29:21 +0100 | [diff] [blame] | 194 | remove_proc(event->proc); |
| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 195 | } |
| 196 | |
| Juan Cespedes | f135052 | 2008-12-16 18:19:58 +0100 | [diff] [blame] | 197 | static void |
| Juan Cespedes | 393f1d0 | 2009-05-07 11:13:54 +0200 | [diff] [blame^] | 198 | process_exit_signal(Event *event) { |
| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 199 | output_line(event->proc, "+++ killed by %s +++", |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 200 | shortsignal(event->proc, event->e_un.signum)); |
| Juan Cespedes | 1fe93d5 | 1998-03-13 00:29:21 +0100 | [diff] [blame] | 201 | remove_proc(event->proc); |
| 202 | } |
| 203 | |
| Juan Cespedes | f135052 | 2008-12-16 18:19:58 +0100 | [diff] [blame] | 204 | static void |
| Juan Cespedes | a8909f7 | 2009-04-28 20:02:41 +0200 | [diff] [blame] | 205 | remove_proc(Process *proc) { |
| 206 | Process *tmp, *tmp2; |
| Juan Cespedes | 1fe93d5 | 1998-03-13 00:29:21 +0100 | [diff] [blame] | 207 | |
| Juan Cespedes | cac15c3 | 2003-01-31 18:58:58 +0100 | [diff] [blame] | 208 | debug(1, "Removing pid %u\n", proc->pid); |
| Juan Cespedes | 28f6019 | 1998-04-12 00:04:39 +0200 | [diff] [blame] | 209 | |
| Juan Cespedes | 1fe93d5 | 1998-03-13 00:29:21 +0100 | [diff] [blame] | 210 | if (list_of_processes == proc) { |
| 211 | tmp = list_of_processes; |
| 212 | list_of_processes = list_of_processes->next; |
| 213 | free(tmp); |
| 214 | return; |
| 215 | } |
| 216 | tmp = list_of_processes; |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 217 | while (tmp->next) { |
| 218 | if (tmp->next == proc) { |
| Juan Cespedes | 1fe93d5 | 1998-03-13 00:29:21 +0100 | [diff] [blame] | 219 | tmp2 = tmp->next; |
| 220 | tmp->next = tmp->next->next; |
| 221 | free(tmp2); |
| Juan Cespedes | 28f6019 | 1998-04-12 00:04:39 +0200 | [diff] [blame] | 222 | continue; |
| Juan Cespedes | 1fe93d5 | 1998-03-13 00:29:21 +0100 | [diff] [blame] | 223 | } |
| Juan Cespedes | 35d7063 | 1998-03-15 14:05:40 +0100 | [diff] [blame] | 224 | tmp = tmp->next; |
| Juan Cespedes | 1fe93d5 | 1998-03-13 00:29:21 +0100 | [diff] [blame] | 225 | } |
| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 226 | } |
| 227 | |
| Juan Cespedes | f135052 | 2008-12-16 18:19:58 +0100 | [diff] [blame] | 228 | static void |
| Juan Cespedes | 393f1d0 | 2009-05-07 11:13:54 +0200 | [diff] [blame^] | 229 | process_syscall(Event *event) { |
| Juan Cespedes | ce377d5 | 2008-12-16 19:38:10 +0100 | [diff] [blame] | 230 | if (options.syscalls) { |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 231 | output_left(LT_TOF_SYSCALL, event->proc, |
| 232 | sysname(event->proc, event->e_un.sysnum)); |
| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 233 | } |
| Juan Cespedes | aee0931 | 2007-08-31 18:49:48 +0200 | [diff] [blame] | 234 | if (fork_p(event->proc, event->e_un.sysnum)) { |
| 235 | disable_all_breakpoints(event->proc); |
| 236 | } else if (event->proc->breakpoints_enabled == 0) { |
| Juan Cespedes | 81690ef | 1998-03-13 19:31:29 +0100 | [diff] [blame] | 237 | enable_all_breakpoints(event->proc); |
| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 238 | } |
| Juan Cespedes | d65efa3 | 2003-02-03 00:22:30 +0100 | [diff] [blame] | 239 | callstack_push_syscall(event->proc, event->e_un.sysnum); |
| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 240 | continue_process(event->proc->pid); |
| 241 | } |
| 242 | |
| Juan Cespedes | f135052 | 2008-12-16 18:19:58 +0100 | [diff] [blame] | 243 | static void |
| Juan Cespedes | 393f1d0 | 2009-05-07 11:13:54 +0200 | [diff] [blame^] | 244 | process_fork(Event * event) { |
| Juan Cespedes | 1e58313 | 2009-04-07 18:17:11 +0200 | [diff] [blame] | 245 | output_line(event->proc, "--- fork() = %u ---", |
| 246 | event->e_un.newpid); |
| 247 | continue_process(event->proc->pid); |
| 248 | } |
| 249 | |
| 250 | static void |
| Juan Cespedes | 393f1d0 | 2009-05-07 11:13:54 +0200 | [diff] [blame^] | 251 | process_clone(Event * event) { |
| Juan Cespedes | 1e58313 | 2009-04-07 18:17:11 +0200 | [diff] [blame] | 252 | output_line(event->proc, "--- clone() = %u ---", |
| 253 | event->e_un.newpid); |
| 254 | abort(); |
| 255 | } |
| 256 | |
| 257 | static void |
| Juan Cespedes | 393f1d0 | 2009-05-07 11:13:54 +0200 | [diff] [blame^] | 258 | process_exec(Event * event) { |
| Juan Cespedes | 1e58313 | 2009-04-07 18:17:11 +0200 | [diff] [blame] | 259 | output_line(event->proc, "--- exec() ---"); |
| 260 | abort(); |
| 261 | } |
| 262 | |
| 263 | static void |
| Juan Cespedes | 393f1d0 | 2009-05-07 11:13:54 +0200 | [diff] [blame^] | 264 | process_arch_syscall(Event *event) { |
| Juan Cespedes | ce377d5 | 2008-12-16 19:38:10 +0100 | [diff] [blame] | 265 | if (options.syscalls) { |
| Juan Cespedes | 63184be | 2008-12-10 13:30:12 +0100 | [diff] [blame] | 266 | output_left(LT_TOF_SYSCALL, event->proc, |
| 267 | arch_sysname(event->proc, event->e_un.sysnum)); |
| 268 | } |
| 269 | if (event->proc->breakpoints_enabled == 0) { |
| 270 | enable_all_breakpoints(event->proc); |
| 271 | } |
| 272 | callstack_push_syscall(event->proc, 0xf0000 + event->e_un.sysnum); |
| 273 | continue_process(event->proc->pid); |
| 274 | } |
| 275 | |
| Juan Cespedes | d65efa3 | 2003-02-03 00:22:30 +0100 | [diff] [blame] | 276 | struct timeval current_time_spent; |
| 277 | |
| Juan Cespedes | f135052 | 2008-12-16 18:19:58 +0100 | [diff] [blame] | 278 | static void |
| Juan Cespedes | a8909f7 | 2009-04-28 20:02:41 +0200 | [diff] [blame] | 279 | calc_time_spent(Process *proc) { |
| Juan Cespedes | d65efa3 | 2003-02-03 00:22:30 +0100 | [diff] [blame] | 280 | struct timeval tv; |
| 281 | struct timezone tz; |
| 282 | struct timeval diff; |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 283 | struct callstack_element *elem; |
| Juan Cespedes | d65efa3 | 2003-02-03 00:22:30 +0100 | [diff] [blame] | 284 | |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 285 | elem = &proc->callstack[proc->callstack_depth - 1]; |
| Juan Cespedes | d65efa3 | 2003-02-03 00:22:30 +0100 | [diff] [blame] | 286 | |
| 287 | gettimeofday(&tv, &tz); |
| 288 | |
| 289 | diff.tv_sec = tv.tv_sec - elem->time_spent.tv_sec; |
| 290 | if (tv.tv_usec >= elem->time_spent.tv_usec) { |
| 291 | diff.tv_usec = tv.tv_usec - elem->time_spent.tv_usec; |
| 292 | } else { |
| 293 | diff.tv_sec++; |
| 294 | diff.tv_usec = 1000000 + tv.tv_usec - elem->time_spent.tv_usec; |
| 295 | } |
| 296 | current_time_spent = diff; |
| 297 | } |
| 298 | |
| Juan Cespedes | f135052 | 2008-12-16 18:19:58 +0100 | [diff] [blame] | 299 | static void |
| Juan Cespedes | 393f1d0 | 2009-05-07 11:13:54 +0200 | [diff] [blame^] | 300 | process_sysret(Event *event) { |
| Juan Cespedes | da9b953 | 2009-04-07 15:33:50 +0200 | [diff] [blame] | 301 | if (opt_T || options.summary) { |
| Juan Cespedes | d65efa3 | 2003-02-03 00:22:30 +0100 | [diff] [blame] | 302 | calc_time_spent(event->proc); |
| 303 | } |
| Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 304 | if (fork_p(event->proc, event->e_un.sysnum)) { |
| Juan Cespedes | cc813cd | 2009-04-07 15:45:53 +0200 | [diff] [blame] | 305 | if (options.follow) { |
| Steve Fink | 65b53df | 2006-09-25 02:27:08 +0200 | [diff] [blame] | 306 | arg_type_info info; |
| Steve Fink | 65b53df | 2006-09-25 02:27:08 +0200 | [diff] [blame] | 307 | info.type = ARGTYPE_LONG; |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 308 | pid_t child = |
| Juan Cespedes | a413e5b | 2007-09-04 17:34:53 +0200 | [diff] [blame] | 309 | gimme_arg(LT_TOF_SYSCALLR, event->proc, -1, &info); |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 310 | if (child > 0) { |
| Juan Cespedes | 273ea6d | 1998-03-14 23:02:40 +0100 | [diff] [blame] | 311 | open_pid(child, 0); |
| 312 | } |
| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 313 | } |
| Juan Cespedes | 35d7063 | 1998-03-15 14:05:40 +0100 | [diff] [blame] | 314 | enable_all_breakpoints(event->proc); |
| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 315 | } |
| Juan Cespedes | 5b3ffdf | 2001-07-02 00:52:45 +0200 | [diff] [blame] | 316 | callstack_pop(event->proc); |
| Juan Cespedes | ce377d5 | 2008-12-16 19:38:10 +0100 | [diff] [blame] | 317 | if (options.syscalls) { |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 318 | output_right(LT_TOF_SYSCALLR, event->proc, |
| 319 | sysname(event->proc, event->e_un.sysnum)); |
| Juan Cespedes | 21c63a1 | 2001-07-07 20:56:56 +0200 | [diff] [blame] | 320 | } |
| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 321 | continue_process(event->proc->pid); |
| 322 | } |
| 323 | |
| Juan Cespedes | f135052 | 2008-12-16 18:19:58 +0100 | [diff] [blame] | 324 | static void |
| Juan Cespedes | 393f1d0 | 2009-05-07 11:13:54 +0200 | [diff] [blame^] | 325 | process_arch_sysret(Event *event) { |
| Juan Cespedes | da9b953 | 2009-04-07 15:33:50 +0200 | [diff] [blame] | 326 | if (opt_T || options.summary) { |
| Juan Cespedes | 63184be | 2008-12-10 13:30:12 +0100 | [diff] [blame] | 327 | calc_time_spent(event->proc); |
| 328 | } |
| 329 | callstack_pop(event->proc); |
| Juan Cespedes | ce377d5 | 2008-12-16 19:38:10 +0100 | [diff] [blame] | 330 | if (options.syscalls) { |
| Juan Cespedes | 63184be | 2008-12-10 13:30:12 +0100 | [diff] [blame] | 331 | output_right(LT_TOF_SYSCALLR, event->proc, |
| 332 | arch_sysname(event->proc, event->e_un.sysnum)); |
| 333 | } |
| 334 | continue_process(event->proc->pid); |
| 335 | } |
| 336 | |
| Juan Cespedes | f135052 | 2008-12-16 18:19:58 +0100 | [diff] [blame] | 337 | static void |
| Juan Cespedes | 393f1d0 | 2009-05-07 11:13:54 +0200 | [diff] [blame^] | 338 | process_breakpoint(Event *event) { |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 339 | int i, j; |
| Juan Cespedes | 1dec217 | 2009-05-07 10:12:10 +0200 | [diff] [blame] | 340 | Breakpoint *sbp; |
| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 341 | |
| Juan Cespedes | efe85f0 | 2004-04-04 01:31:38 +0200 | [diff] [blame] | 342 | debug(2, "event: breakpoint (%p)", event->e_un.brk_addr); |
| Luis Machado | 55c5feb | 2008-03-12 15:56:01 +0100 | [diff] [blame] | 343 | |
| Paul Gilliam | 76c61f1 | 2006-06-14 06:55:21 +0200 | [diff] [blame] | 344 | #ifdef __powerpc__ |
| Luis Machado | 55c5feb | 2008-03-12 15:56:01 +0100 | [diff] [blame] | 345 | /* Need to skip following NOP's to prevent a fake function from being stacked. */ |
| 346 | long stub_addr = (long) get_count_register(event->proc); |
| Juan Cespedes | 1dec217 | 2009-05-07 10:12:10 +0200 | [diff] [blame] | 347 | Breakpoint *stub_bp = NULL; |
| Luis Machado | 55c5feb | 2008-03-12 15:56:01 +0100 | [diff] [blame] | 348 | char nop_instruction[] = PPC_NOP; |
| 349 | |
| 350 | stub_bp = address2bpstruct (event->proc, event->e_un.brk_addr); |
| 351 | |
| 352 | if (stub_bp) { |
| 353 | unsigned char *bp_instruction = stub_bp->orig_value; |
| 354 | |
| 355 | if (memcmp(bp_instruction, nop_instruction, |
| 356 | PPC_NOP_LENGTH) == 0) { |
| 357 | if (stub_addr != (long) event->e_un.brk_addr) { |
| 358 | set_instruction_pointer (event->proc, event->e_un.brk_addr + 4); |
| 359 | continue_process(event->proc->pid); |
| Paul Gilliam | 76c61f1 | 2006-06-14 06:55:21 +0200 | [diff] [blame] | 360 | return; |
| 361 | } |
| 362 | } |
| Luis Machado | 55c5feb | 2008-03-12 15:56:01 +0100 | [diff] [blame] | 363 | } |
| Paul Gilliam | 76c61f1 | 2006-06-14 06:55:21 +0200 | [diff] [blame] | 364 | #endif |
| Luis Machado | 55c5feb | 2008-03-12 15:56:01 +0100 | [diff] [blame] | 365 | if ((sbp = event->proc->breakpoint_being_enabled) != 0) { |
| Juan Cespedes | b1dd77d | 2002-03-03 00:22:06 +0100 | [diff] [blame] | 366 | /* Reinsert breakpoint */ |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 367 | continue_enabling_breakpoint(event->proc->pid, |
| 368 | event->proc-> |
| 369 | breakpoint_being_enabled); |
| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 370 | event->proc->breakpoint_being_enabled = NULL; |
| 371 | return; |
| 372 | } |
| Juan Cespedes | 5b3ffdf | 2001-07-02 00:52:45 +0200 | [diff] [blame] | 373 | |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 374 | for (i = event->proc->callstack_depth - 1; i >= 0; i--) { |
| 375 | if (event->e_un.brk_addr == |
| 376 | event->proc->callstack[i].return_addr) { |
| Juan Cespedes | 5bfb061 | 2002-03-31 20:01:28 +0200 | [diff] [blame] | 377 | #ifdef __powerpc__ |
| Ian Wienand | 3219f32 | 2006-02-16 06:00:00 +0100 | [diff] [blame] | 378 | /* |
| 379 | * PPC HACK! (XXX FIXME TODO) |
| 380 | * The PLT gets modified during the first call, |
| 381 | * so be sure to re-enable the breakpoint. |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 382 | */ |
| Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 383 | unsigned long a; |
| 384 | struct library_symbol *libsym = |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 385 | event->proc->callstack[i].c_un.libfunc; |
| Paul Gilliam | 76c61f1 | 2006-06-14 06:55:21 +0200 | [diff] [blame] | 386 | void *addr = sym2addr(event->proc, libsym); |
| Juan Cespedes | 5bfb061 | 2002-03-31 20:01:28 +0200 | [diff] [blame] | 387 | |
| Paul Gilliam | 76c61f1 | 2006-06-14 06:55:21 +0200 | [diff] [blame] | 388 | if (libsym->plt_type != LS_TOPLT_POINT) { |
| Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 389 | unsigned char break_insn[] = BREAKPOINT_VALUE; |
| 390 | |
| 391 | sbp = address2bpstruct(event->proc, addr); |
| 392 | assert(sbp); |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 393 | a = ptrace(PTRACE_PEEKTEXT, event->proc->pid, |
| 394 | addr); |
| Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 395 | |
| Paul Gilliam | 76c61f1 | 2006-06-14 06:55:21 +0200 | [diff] [blame] | 396 | if (memcmp(&a, break_insn, BREAKPOINT_LENGTH)) { |
| Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 397 | sbp->enabled--; |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 398 | insert_breakpoint(event->proc, addr, |
| 399 | libsym); |
| Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 400 | } |
| 401 | } else { |
| 402 | sbp = libsym->brkpnt; |
| 403 | assert(sbp); |
| Paul Gilliam | 76c61f1 | 2006-06-14 06:55:21 +0200 | [diff] [blame] | 404 | if (addr != sbp->addr) { |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 405 | insert_breakpoint(event->proc, addr, |
| 406 | libsym); |
| Paul Gilliam | 76c61f1 | 2006-06-14 06:55:21 +0200 | [diff] [blame] | 407 | } |
| Ian Wienand | 3219f32 | 2006-02-16 06:00:00 +0100 | [diff] [blame] | 408 | } |
| Eric Vaitl | 1228a91 | 2006-12-28 16:16:56 +0100 | [diff] [blame] | 409 | #elif defined(__mips__) |
| Juan Cespedes | a413e5b | 2007-09-04 17:34:53 +0200 | [diff] [blame] | 410 | void *addr; |
| 411 | void *old_addr; |
| 412 | struct library_symbol *sym= event->proc->callstack[i].c_un.libfunc; |
| 413 | assert(sym && sym->brkpnt); |
| 414 | old_addr=sym->brkpnt->addr; |
| 415 | addr=sym2addr(event->proc,sym); |
| 416 | assert(old_addr !=0 && addr !=0); |
| 417 | if(addr != old_addr){ |
| 418 | struct library_symbol *new_sym; |
| 419 | new_sym=malloc(sizeof(*new_sym)); |
| 420 | memcpy(new_sym,sym,sizeof(*new_sym)); |
| 421 | new_sym->next=event->proc->list_of_symbols; |
| 422 | event->proc->list_of_symbols=new_sym; |
| 423 | new_sym->brkpnt=0; |
| 424 | insert_breakpoint(event->proc, addr, new_sym); |
| 425 | } |
| Juan Cespedes | 5bfb061 | 2002-03-31 20:01:28 +0200 | [diff] [blame] | 426 | #endif |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 427 | for (j = event->proc->callstack_depth - 1; j > i; j--) { |
| Juan Cespedes | 5916fda | 2002-02-25 00:19:21 +0100 | [diff] [blame] | 428 | callstack_pop(event->proc); |
| 429 | } |
| Juan Cespedes | da9b953 | 2009-04-07 15:33:50 +0200 | [diff] [blame] | 430 | if (opt_T || options.summary) { |
| Juan Cespedes | d65efa3 | 2003-02-03 00:22:30 +0100 | [diff] [blame] | 431 | calc_time_spent(event->proc); |
| 432 | } |
| 433 | callstack_pop(event->proc); |
| Juan Cespedes | 5916fda | 2002-02-25 00:19:21 +0100 | [diff] [blame] | 434 | event->proc->return_addr = event->e_un.brk_addr; |
| Juan Cespedes | 5c3fe06 | 2004-06-14 18:08:37 +0200 | [diff] [blame] | 435 | output_right(LT_TOF_FUNCTIONR, event->proc, |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 436 | event->proc->callstack[i].c_un.libfunc-> |
| 437 | name); |
| Juan Cespedes | 5916fda | 2002-02-25 00:19:21 +0100 | [diff] [blame] | 438 | continue_after_breakpoint(event->proc, |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 439 | address2bpstruct(event->proc, |
| 440 | event->e_un. |
| 441 | brk_addr)); |
| Juan Cespedes | 5916fda | 2002-02-25 00:19:21 +0100 | [diff] [blame] | 442 | return; |
| 443 | } |
| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 444 | } |
| 445 | |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 446 | if ((sbp = address2bpstruct(event->proc, event->e_un.brk_addr))) { |
| 447 | event->proc->stack_pointer = get_stack_pointer(event->proc); |
| 448 | event->proc->return_addr = |
| 449 | get_return_addr(event->proc, event->proc->stack_pointer); |
| 450 | output_left(LT_TOF_FUNCTION, event->proc, sbp->libsym->name); |
| 451 | callstack_push_symfunc(event->proc, sbp->libsym); |
| Paul Gilliam | be32077 | 2006-04-24 22:06:23 +0200 | [diff] [blame] | 452 | #ifdef PLT_REINITALISATION_BP |
| 453 | if (event->proc->need_to_reinitialize_breakpoints |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 454 | && (strcmp(sbp->libsym->name, PLTs_initialized_by_here) == |
| 455 | 0)) |
| 456 | reinitialize_breakpoints(event->proc); |
| Paul Gilliam | be32077 | 2006-04-24 22:06:23 +0200 | [diff] [blame] | 457 | #endif |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 458 | |
| 459 | continue_after_breakpoint(event->proc, sbp); |
| 460 | return; |
| 461 | } |
| Ian Wienand | 9a2ad35 | 2006-02-20 22:44:45 +0100 | [diff] [blame] | 462 | |
| 463 | output_line(event->proc, "unexpected breakpoint at %p", |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 464 | (void *)event->e_un.brk_addr); |
| Juan Cespedes | 5e01f65 | 1998-03-08 22:31:44 +0100 | [diff] [blame] | 465 | continue_process(event->proc->pid); |
| 466 | } |
| Juan Cespedes | 5b3ffdf | 2001-07-02 00:52:45 +0200 | [diff] [blame] | 467 | |
| Juan Cespedes | f135052 | 2008-12-16 18:19:58 +0100 | [diff] [blame] | 468 | static void |
| Juan Cespedes | a8909f7 | 2009-04-28 20:02:41 +0200 | [diff] [blame] | 469 | callstack_push_syscall(Process *proc, int sysnum) { |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 470 | struct callstack_element *elem; |
| Juan Cespedes | 5b3ffdf | 2001-07-02 00:52:45 +0200 | [diff] [blame] | 471 | |
| 472 | /* FIXME: not good -- should use dynamic allocation. 19990703 mortene. */ |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 473 | if (proc->callstack_depth == MAX_CALLDEPTH - 1) { |
| Juan Cespedes | 5b3ffdf | 2001-07-02 00:52:45 +0200 | [diff] [blame] | 474 | fprintf(stderr, "Error: call nesting too deep!\n"); |
| 475 | return; |
| 476 | } |
| 477 | |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 478 | elem = &proc->callstack[proc->callstack_depth]; |
| Juan Cespedes | 5b3ffdf | 2001-07-02 00:52:45 +0200 | [diff] [blame] | 479 | elem->is_syscall = 1; |
| 480 | elem->c_un.syscall = sysnum; |
| 481 | elem->return_addr = NULL; |
| 482 | |
| 483 | proc->callstack_depth++; |
| Juan Cespedes | da9b953 | 2009-04-07 15:33:50 +0200 | [diff] [blame] | 484 | if (opt_T || options.summary) { |
| Juan Cespedes | d65efa3 | 2003-02-03 00:22:30 +0100 | [diff] [blame] | 485 | struct timezone tz; |
| 486 | gettimeofday(&elem->time_spent, &tz); |
| 487 | } |
| Juan Cespedes | 5b3ffdf | 2001-07-02 00:52:45 +0200 | [diff] [blame] | 488 | } |
| 489 | |
| Juan Cespedes | 21c63a1 | 2001-07-07 20:56:56 +0200 | [diff] [blame] | 490 | static void |
| Juan Cespedes | a8909f7 | 2009-04-28 20:02:41 +0200 | [diff] [blame] | 491 | callstack_push_symfunc(Process *proc, struct library_symbol *sym) { |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 492 | struct callstack_element *elem; |
| Juan Cespedes | 5b3ffdf | 2001-07-02 00:52:45 +0200 | [diff] [blame] | 493 | |
| 494 | /* FIXME: not good -- should use dynamic allocation. 19990703 mortene. */ |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 495 | if (proc->callstack_depth == MAX_CALLDEPTH - 1) { |
| Juan Cespedes | 5b3ffdf | 2001-07-02 00:52:45 +0200 | [diff] [blame] | 496 | fprintf(stderr, "Error: call nesting too deep!\n"); |
| 497 | return; |
| 498 | } |
| 499 | |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 500 | elem = &proc->callstack[proc->callstack_depth]; |
| Juan Cespedes | 5b3ffdf | 2001-07-02 00:52:45 +0200 | [diff] [blame] | 501 | elem->is_syscall = 0; |
| 502 | elem->c_un.libfunc = sym; |
| 503 | |
| Juan Cespedes | 3f0b62e | 2001-07-09 01:02:52 +0200 | [diff] [blame] | 504 | elem->return_addr = proc->return_addr; |
| Juan Cespedes | a413e5b | 2007-09-04 17:34:53 +0200 | [diff] [blame] | 505 | if (elem->return_addr) { |
| Paul Gilliam | 76c61f1 | 2006-06-14 06:55:21 +0200 | [diff] [blame] | 506 | insert_breakpoint(proc, elem->return_addr, 0); |
| 507 | } |
| Juan Cespedes | 5b3ffdf | 2001-07-02 00:52:45 +0200 | [diff] [blame] | 508 | |
| 509 | proc->callstack_depth++; |
| Juan Cespedes | da9b953 | 2009-04-07 15:33:50 +0200 | [diff] [blame] | 510 | if (opt_T || options.summary) { |
| Juan Cespedes | d65efa3 | 2003-02-03 00:22:30 +0100 | [diff] [blame] | 511 | struct timezone tz; |
| 512 | gettimeofday(&elem->time_spent, &tz); |
| 513 | } |
| Juan Cespedes | 5b3ffdf | 2001-07-02 00:52:45 +0200 | [diff] [blame] | 514 | } |
| 515 | |
| Juan Cespedes | f135052 | 2008-12-16 18:19:58 +0100 | [diff] [blame] | 516 | static void |
| Juan Cespedes | a8909f7 | 2009-04-28 20:02:41 +0200 | [diff] [blame] | 517 | callstack_pop(Process *proc) { |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 518 | struct callstack_element *elem; |
| Juan Cespedes | 5b3ffdf | 2001-07-02 00:52:45 +0200 | [diff] [blame] | 519 | assert(proc->callstack_depth > 0); |
| 520 | |
| Ian Wienand | 2d45b1a | 2006-02-20 22:48:07 +0100 | [diff] [blame] | 521 | elem = &proc->callstack[proc->callstack_depth - 1]; |
| Paul Gilliam | 76c61f1 | 2006-06-14 06:55:21 +0200 | [diff] [blame] | 522 | if (!elem->is_syscall && elem->return_addr) { |
| Juan Cespedes | 5b3ffdf | 2001-07-02 00:52:45 +0200 | [diff] [blame] | 523 | delete_breakpoint(proc, elem->return_addr); |
| 524 | } |
| 525 | proc->callstack_depth--; |
| Juan Cespedes | 5b3ffdf | 2001-07-02 00:52:45 +0200 | [diff] [blame] | 526 | } |