Lines Matching refs:tcp
89 static void delete_mmap_cache(struct tcb *tcp, const char *caller);
104 unwind_tcb_init(struct tcb *tcp) in unwind_tcb_init() argument
106 tcp->libunwind_ui = _UPT_create(tcp->pid); in unwind_tcb_init()
107 if (!tcp->libunwind_ui) in unwind_tcb_init()
110 tcp->queue = xmalloc(sizeof(*tcp->queue)); in unwind_tcb_init()
111 tcp->queue->head = NULL; in unwind_tcb_init()
112 tcp->queue->tail = NULL; in unwind_tcb_init()
116 unwind_tcb_fin(struct tcb *tcp) in unwind_tcb_fin() argument
118 queue_print(tcp->queue); in unwind_tcb_fin()
119 free(tcp->queue); in unwind_tcb_fin()
120 tcp->queue = NULL; in unwind_tcb_fin()
122 delete_mmap_cache(tcp, __FUNCTION__); in unwind_tcb_fin()
124 _UPT_destroy(tcp->libunwind_ui); in unwind_tcb_fin()
125 tcp->libunwind_ui = NULL; in unwind_tcb_fin()
135 build_mmap_cache(struct tcb* tcp) in build_mmap_cache() argument
146 sprintf(filename, "/proc/%u/maps", tcp->pid); in build_mmap_cache()
179 if (tcp->mmap_cache_size > 0) { in build_mmap_cache()
180 entry = &cache_head[tcp->mmap_cache_size - 1]; in build_mmap_cache()
194 if (tcp->mmap_cache_size >= cur_array_size) { in build_mmap_cache()
200 entry = &cache_head[tcp->mmap_cache_size]; in build_mmap_cache()
205 tcp->mmap_cache_size++; in build_mmap_cache()
208 tcp->mmap_cache = cache_head; in build_mmap_cache()
209 tcp->mmap_cache_generation = mmap_cache_generation; in build_mmap_cache()
213 tcp->mmap_cache_generation, in build_mmap_cache()
215 tcp, tcp->mmap_cache); in build_mmap_cache()
220 delete_mmap_cache(struct tcb *tcp, const char *caller) in delete_mmap_cache() argument
226 tcp->mmap_cache_generation, in delete_mmap_cache()
228 tcp, tcp->mmap_cache, caller); in delete_mmap_cache()
230 for (i = 0; i < tcp->mmap_cache_size; i++) { in delete_mmap_cache()
231 free(tcp->mmap_cache[i].binary_filename); in delete_mmap_cache()
232 tcp->mmap_cache[i].binary_filename = NULL; in delete_mmap_cache()
234 free(tcp->mmap_cache); in delete_mmap_cache()
235 tcp->mmap_cache = NULL; in delete_mmap_cache()
236 tcp->mmap_cache_size = 0; in delete_mmap_cache()
240 rebuild_cache_if_invalid(struct tcb *tcp, const char *caller) in rebuild_cache_if_invalid() argument
242 if ((tcp->mmap_cache_generation != mmap_cache_generation) in rebuild_cache_if_invalid()
243 && tcp->mmap_cache) in rebuild_cache_if_invalid()
244 delete_mmap_cache(tcp, caller); in rebuild_cache_if_invalid()
246 if (!tcp->mmap_cache) in rebuild_cache_if_invalid()
247 build_mmap_cache(tcp); in rebuild_cache_if_invalid()
249 if (!tcp->mmap_cache || !tcp->mmap_cache_size) in rebuild_cache_if_invalid()
256 unwind_cache_invalidate(struct tcb* tcp) in unwind_cache_invalidate() argument
259 if (tcp->currpers != DEFAULT_PERSONALITY) { in unwind_cache_invalidate()
266 tcp->mmap_cache_generation, in unwind_cache_invalidate()
268 tcp, in unwind_cache_invalidate()
269 tcp->mmap_cache); in unwind_cache_invalidate()
291 print_stack_frame(struct tcb *tcp, in print_stack_frame() argument
301 int upper = (int) tcp->mmap_cache_size - 1; in print_stack_frame()
304 perror_msg("Can't walk the stack of process %d", tcp->pid); in print_stack_frame()
312 cur_mmap_cache = &tcp->mmap_cache[mid]; in print_stack_frame()
350 stacktrace_walk(struct tcb *tcp, in stacktrace_walk() argument
360 if (!tcp->mmap_cache) in stacktrace_walk()
362 if (tcp->mmap_cache_size == 0) in stacktrace_walk()
367 if (unw_init_remote(&cursor, libunwind_as, tcp->libunwind_ui) < 0) in stacktrace_walk()
371 if (print_stack_frame(tcp, call_action, error_action, data, in stacktrace_walk()
547 unwind_print_stacktrace(struct tcb* tcp) in unwind_print_stacktrace() argument
550 if (tcp->currpers != DEFAULT_PERSONALITY) { in unwind_print_stacktrace()
555 if (tcp->queue->head) { in unwind_print_stacktrace()
556 DPRINTF("tcp=%p, queue=%p", "queueprint", tcp, tcp->queue->head); in unwind_print_stacktrace()
557 queue_print(tcp->queue); in unwind_print_stacktrace()
559 else if (rebuild_cache_if_invalid(tcp, __FUNCTION__)) { in unwind_print_stacktrace()
560 DPRINTF("tcp=%p, queue=%p", "stackprint", tcp, tcp->queue->head); in unwind_print_stacktrace()
561 stacktrace_walk(tcp, print_call_cb, print_error_cb, NULL); in unwind_print_stacktrace()
569 unwind_capture_stacktrace(struct tcb *tcp) in unwind_capture_stacktrace() argument
572 if (tcp->currpers != DEFAULT_PERSONALITY) { in unwind_capture_stacktrace()
577 if (tcp->queue->head) in unwind_capture_stacktrace()
580 if (rebuild_cache_if_invalid(tcp, __FUNCTION__)) { in unwind_capture_stacktrace()
581 stacktrace_walk(tcp, queue_put_call, queue_put_error, in unwind_capture_stacktrace()
582 tcp->queue); in unwind_capture_stacktrace()
583 DPRINTF("tcp=%p, queue=%p", "captured", tcp, tcp->queue->head); in unwind_capture_stacktrace()