1a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm/* libunwind - a platform-independent unwind library 207b01ad205162a93dab42722caaa4dbb7ba43b3fhp.com!davidm Copyright (C) 2001-2002, 2005 Hewlett-Packard Co 3a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm Contributed by David Mosberger-Tang <davidm@hpl.hp.com> 4a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm 5a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidmThis file is part of libunwind. 6a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm 7a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidmPermission is hereby granted, free of charge, to any person obtaining 8a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidma copy of this software and associated documentation files (the 9a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm"Software"), to deal in the Software without restriction, including 10a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidmwithout limitation the rights to use, copy, modify, merge, publish, 11a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidmdistribute, sublicense, and/or sell copies of the Software, and to 12a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidmpermit persons to whom the Software is furnished to do so, subject to 13a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidmthe following conditions: 14a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm 15a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidmThe above copyright notice and this permission notice shall be 16a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidmincluded in all copies or substantial portions of the Software. 17a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm 18a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidmTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidmEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidmMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidmNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 22a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidmLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidmOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 24a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidmWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ 25a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm 2607b01ad205162a93dab42722caaa4dbb7ba43b3fhp.com!davidm#include "libunwind_i.h" 27a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm 28a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm#ifdef UNW_REMOTE_ONLY 29a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm 30a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidmstatic inline int 31a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidmlocal_find_proc_info (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi, 32a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm int need_unwind_info, void *arg) 33a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm{ 34a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm return -UNW_ENOINFO; 35a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm} 36a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm 37a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm#else /* !UNW_REMOTE_ONLY */ 38a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm 39a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidmstatic inline int 40a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidmlocal_find_proc_info (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi, 41a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm int need_unwind_info, void *arg) 42a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm{ 43a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm unw_dyn_info_list_t *list; 44a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm unw_dyn_info_t *di; 45a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm 46d15f52662a2565141df0ac151baf7630f42e4ceahp.com!davidm#ifndef UNW_LOCAL_ONLY 47d15f52662a2565141df0ac151baf7630f42e4ceahp.com!davidm# pragma weak _U_dyn_info_list_addr 48d15f52662a2565141df0ac151baf7630f42e4ceahp.com!davidm if (!_U_dyn_info_list_addr) 49d15f52662a2565141df0ac151baf7630f42e4ceahp.com!davidm return -UNW_ENOINFO; 50d15f52662a2565141df0ac151baf7630f42e4ceahp.com!davidm#endif 51d15f52662a2565141df0ac151baf7630f42e4ceahp.com!davidm 523842dac7333e42aa44531eda34ba55200b99ccf8Daniel Jacobowitz list = (unw_dyn_info_list_t *) (uintptr_t) _U_dyn_info_list_addr (); 53a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm for (di = list->first; di; di = di->next) 54a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm if (ip >= di->start_ip && ip < di->end_ip) 55a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm return unwi_extract_dynamic_proc_info (as, ip, pi, di, need_unwind_info, 56a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm arg); 57a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm return -UNW_ENOINFO; 58a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm} 59a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm 60a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm#endif /* !UNW_REMOTE_ONLY */ 61a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm 62a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm#ifdef UNW_LOCAL_ONLY 63a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm 64a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidmstatic inline int 65a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidmremote_find_proc_info (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi, 66a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm int need_unwind_info, void *arg) 67a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm{ 68a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm return -UNW_ENOINFO; 69a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm} 70a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm 71a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm#else /* !UNW_LOCAL_ONLY */ 72a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm 73a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidmstatic inline int 74a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidmremote_find_proc_info (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi, 75a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm int need_unwind_info, void *arg) 76a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm{ 77a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm return unwi_dyn_remote_find_proc_info (as, ip, pi, need_unwind_info, arg); 78a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm} 79a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm 80a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm#endif /* !UNW_LOCAL_ONLY */ 81a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm 82a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidmHIDDEN int 83a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidmunwi_find_dynamic_proc_info (unw_addr_space_t as, unw_word_t ip, 84a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm unw_proc_info_t *pi, int need_unwind_info, 85a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm void *arg) 86a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm{ 87a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm if (as == unw_local_addr_space) 88a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm return local_find_proc_info (as, ip, pi, need_unwind_info, arg); 89a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm else 90a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm return remote_find_proc_info (as, ip, pi, need_unwind_info, arg); 91a30e99da14d8841829ee02af7063d9075a6def0ahp.com!davidm} 92