Lines Matching refs:thread

84 static bool is_on_user_stack(struct thread* _thread, uintptr_t addr);
85 static bool is_on_kernel_stack(struct thread* thread, uintptr_t addr);
87 static void print_stack_address(struct thread* thread, uintptr_t addr) { in print_stack_address() argument
95 if (is_on_user_stack(thread, addr)) { in print_stack_address()
96 struct trusty_thread* trusty_thread = trusty_thread_get(thread); in print_stack_address()
103 if (is_on_kernel_stack(thread, addr)) { in print_stack_address()
104 printf("kSP+0x%" PRI0xSTKOFF "x", addr - (uintptr_t)thread->stack); in print_stack_address()
119 static void print_function_info(struct thread* thread, in print_function_info() argument
127 print_stack_address(thread, frame->frame_addr); in print_function_info()
147 static void dump_user_function(struct thread* thread, in dump_user_function() argument
155 print_function_info(thread, frame, load_bias, &info); in dump_user_function()
157 print_function_info(thread, frame, load_bias, NULL); in dump_user_function()
161 static void dump_kernel_function(struct thread* thread, in dump_kernel_function() argument
168 print_function_info(thread, frame, load_bias, NULL); in dump_kernel_function()
176 static void dump_function(thread_t* thread, struct stack_frame* frame) { in dump_function() argument
180 struct trusty_thread* trusty_thread = trusty_thread_get(thread); in dump_function()
181 dump_user_function(thread, trusty_thread ? trusty_thread->app : NULL, in dump_function()
184 dump_kernel_function(thread, frame); in dump_function()
186 print_function_info(thread, frame, 0, NULL); in dump_function()
190 static bool is_on_user_stack(struct thread* _thread, uintptr_t addr) { in is_on_user_stack()
193 struct trusty_thread* thread = trusty_thread_get(_thread); in is_on_user_stack() local
195 if (!thread) { in is_on_user_stack()
199 stack_end = thread->stack_start; in is_on_user_stack()
200 if (__builtin_sub_overflow(stack_end, thread->stack_size, &stack_bottom)) { in is_on_user_stack()
207 static bool is_on_kernel_stack(struct thread* thread, uintptr_t addr) { in is_on_kernel_stack() argument
211 stack_bottom = (uintptr_t)thread->stack; in is_on_kernel_stack()
212 if (__builtin_add_overflow(stack_bottom, thread->stack_size, &stack_end)) { in is_on_kernel_stack()
227 static bool is_on_stack(struct thread* thread, uintptr_t addr, bool user) { in is_on_stack() argument
229 return is_on_user_stack(thread, addr); in is_on_stack()
231 return is_on_kernel_stack(thread, addr); in is_on_stack()
247 static int dump_monotonic_backtrace(struct thread* thread, in dump_monotonic_backtrace() argument
253 dump_function(thread, frame); in dump_monotonic_backtrace()
255 if (is_on_stack(thread, frame->fp, !user)) { in dump_monotonic_backtrace()
263 if (!is_on_stack(thread, frame->fp, user)) { in dump_monotonic_backtrace()
275 static void dump_backtrace_etc(struct thread* thread, in dump_backtrace_etc() argument
285 int frame_state = dump_monotonic_backtrace(thread, frame, false); in dump_backtrace_etc()
294 frame_state = dump_monotonic_backtrace(thread, frame, false); in dump_backtrace_etc()
298 frame_state = dump_monotonic_backtrace(thread, frame, true); in dump_backtrace_etc()
307 dump_function(thread, frame); in dump_backtrace_etc()
311 dump_function(thread, frame); in dump_backtrace_etc()
315 void dump_thread_backtrace(struct thread* thread) { in dump_thread_backtrace() argument
316 if (!thread) { in dump_thread_backtrace()
325 assert(thread == get_current_thread()); in dump_thread_backtrace()
330 printf("\nBacktrace for thread: %s\n", thread->name); in dump_thread_backtrace()
338 dump_backtrace_etc(thread, &frame); in dump_thread_backtrace()