From patchwork Mon Aug 15 18:23:11 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ken Werner X-Patchwork-Id: 3456 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 1321023E51 for ; Mon, 15 Aug 2011 18:23:29 +0000 (UTC) Received: from mail-ew0-f52.google.com (mail-ew0-f52.google.com [209.85.215.52]) by fiordland.canonical.com (Postfix) with ESMTP id F20F1A180E9 for ; Mon, 15 Aug 2011 18:23:28 +0000 (UTC) Received: by ewy28 with SMTP id 28so2749757ewy.11 for ; Mon, 15 Aug 2011 11:23:28 -0700 (PDT) Received: by 10.213.14.67 with SMTP id f3mr588499eba.56.1313432608532; Mon, 15 Aug 2011 11:23:28 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.213.102.5 with SMTP id e5cs109373ebo; Mon, 15 Aug 2011 11:23:27 -0700 (PDT) Received: from mr.google.com ([10.216.237.233]) by 10.216.237.233 with SMTP id y83mr3923965weq.9.1313432607778 (num_hops = 1); Mon, 15 Aug 2011 11:23:27 -0700 (PDT) Received: by 10.216.237.233 with SMTP id y83mr2677055weq.9.1313432603964; Mon, 15 Aug 2011 11:23:23 -0700 (PDT) Received: from mtagate2.uk.ibm.com (mtagate2.uk.ibm.com [194.196.100.162]) by mx.google.com with ESMTPS id x52si16535313wec.114.2011.08.15.11.23.23 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 15 Aug 2011 11:23:23 -0700 (PDT) Received-SPF: neutral (google.com: 194.196.100.162 is neither permitted nor denied by best guess record for domain of ken.werner@linaro.org) client-ip=194.196.100.162; Authentication-Results: mx.google.com; spf=neutral (google.com: 194.196.100.162 is neither permitted nor denied by best guess record for domain of ken.werner@linaro.org) smtp.mail=ken.werner@linaro.org Received: from d06nrmr1307.portsmouth.uk.ibm.com (d06nrmr1307.portsmouth.uk.ibm.com [9.149.38.129]) by mtagate2.uk.ibm.com (8.13.1/8.13.1) with ESMTP id p7FINFRn032434 for ; Mon, 15 Aug 2011 18:23:15 GMT Received: from d06av11.portsmouth.uk.ibm.com (d06av11.portsmouth.uk.ibm.com [9.149.37.252]) by d06nrmr1307.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p7FINFaa2494592 for ; Mon, 15 Aug 2011 19:23:15 +0100 Received: from d06av11.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av11.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p7FINFwN007329 for ; Mon, 15 Aug 2011 12:23:15 -0600 Received: from leonard.boeblingen.de.ibm.com (dyn-9-152-224-36.boeblingen.de.ibm.com [9.152.224.36]) by d06av11.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p7FINFRs007316; Mon, 15 Aug 2011 12:23:15 -0600 From: Ken Werner To: libunwind-devel@nongnu.org Subject: [PATCH 1/4] Make the dwarf dl_iterate_phdr callback available within libunwind. Date: Mon, 15 Aug 2011 20:23:11 +0200 Message-Id: <1313432594-23980-2-git-send-email-ken.werner@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1313432594-23980-1-git-send-email-ken.werner@linaro.org> References: <1313432594-23980-1-git-send-email-ken.werner@linaro.org> Rename the dwarf dl_iterate_phdr callback routine and the callback_data structure to dwarf_callback and dwarf_callback_data. Make it available within libunwind by declaring the two at the dwarf.h header file. Signed-off-by: Ken Werner --- include/dwarf.h | 14 ++++++++++++++ src/dwarf/Gfind_proc_info-lsb.c | 24 ++++++------------------ 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/include/dwarf.h b/include/dwarf.h index 334aaad..3fe6b48 100644 --- a/include/dwarf.h +++ b/include/dwarf.h @@ -347,8 +347,21 @@ struct unw_debug_frame_list struct unw_debug_frame_list *next; }; +struct dwarf_callback_data + { + /* in: */ + unw_word_t ip; /* instruction-pointer we're looking for */ + unw_proc_info_t *pi; /* proc-info pointer */ + int need_unwind_info; + /* out: */ + int single_fde; /* did we find a single FDE? (vs. a table) */ + unw_dyn_info_t di; /* table info (if single_fde is false) */ + unw_dyn_info_t di_debug; /* additional table info for .debug_frame */ + }; + /* Convenience macros: */ #define dwarf_init UNW_ARCH_OBJ (dwarf_init) +#define dwarf_callback UNW_OBJ (dwarf_callback) #define dwarf_find_proc_info UNW_OBJ (dwarf_find_proc_info) #define dwarf_find_debug_frame UNW_OBJ (dwarf_find_debug_frame) #define dwarf_search_unwind_table UNW_OBJ (dwarf_search_unwind_table) @@ -364,6 +377,7 @@ struct unw_debug_frame_list #define dwarf_step UNW_OBJ (dwarf_step) extern int dwarf_init (void); +extern int dwarf_callback (struct dl_phdr_info *info, size_t size, void *ptr); extern int dwarf_find_proc_info (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi, int need_unwind_info, void *arg); diff --git a/src/dwarf/Gfind_proc_info-lsb.c b/src/dwarf/Gfind_proc_info-lsb.c index d65342c..22899d8 100644 --- a/src/dwarf/Gfind_proc_info-lsb.c +++ b/src/dwarf/Gfind_proc_info-lsb.c @@ -47,18 +47,6 @@ struct table_entry #include "os-linux.h" #endif -struct callback_data - { - /* in: */ - unw_word_t ip; /* instruction-pointer we're looking for */ - unw_proc_info_t *pi; /* proc-info pointer */ - int need_unwind_info; - /* out: */ - int single_fde; /* did we find a single FDE? (vs. a table) */ - unw_dyn_info_t di; /* table info (if single_fde is false) */ - unw_dyn_info_t di_debug; /* additional table info for .debug_frame */ - }; - static int linear_search (unw_addr_space_t as, unw_word_t ip, unw_word_t eh_frame_start, unw_word_t eh_frame_end, @@ -567,13 +555,13 @@ dwarf_find_debug_frame (int found, unw_dyn_info_t *di_debug, #endif /* CONFIG_DEBUG_FRAME */ -/* ptr is a pointer to a callback_data structure and, on entry, +/* ptr is a pointer to a dwarf_callback_data structure and, on entry, member ip contains the instruction-pointer we're looking for. */ -static int -callback (struct dl_phdr_info *info, size_t size, void *ptr) +HIDDEN int +dwarf_callback (struct dl_phdr_info *info, size_t size, void *ptr) { - struct callback_data *cb_data = ptr; + struct dwarf_callback_data *cb_data = ptr; unw_dyn_info_t *di = &cb_data->di; const Elf_W(Phdr) *phdr, *p_eh_hdr, *p_dynamic, *p_text; unw_word_t addr, eh_frame_start, eh_frame_end, fde_count, ip; @@ -754,7 +742,7 @@ HIDDEN int dwarf_find_proc_info (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi, int need_unwind_info, void *arg) { - struct callback_data cb_data; + struct dwarf_callback_data cb_data; intrmask_t saved_mask; int ret; @@ -768,7 +756,7 @@ dwarf_find_proc_info (unw_addr_space_t as, unw_word_t ip, cb_data.di_debug.format = -1; SIGPROCMASK (SIG_SETMASK, &unwi_full_mask, &saved_mask); - ret = dl_iterate_phdr (callback, &cb_data); + ret = dl_iterate_phdr (dwarf_callback, &cb_data); SIGPROCMASK (SIG_SETMASK, &saved_mask, NULL); if (ret <= 0)