From patchwork Mon Aug 29 16:19:44 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ken Werner X-Patchwork-Id: 3770 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 4BEA723E54 for ; Mon, 29 Aug 2011 16:19:50 +0000 (UTC) Received: from mail-fx0-f52.google.com (mail-fx0-f52.google.com [209.85.161.52]) by fiordland.canonical.com (Postfix) with ESMTP id ED4F6A18126 for ; Mon, 29 Aug 2011 16:19:49 +0000 (UTC) Received: by mail-fx0-f52.google.com with SMTP id 18so6763318fxd.11 for ; Mon, 29 Aug 2011 09:19:49 -0700 (PDT) Received: by 10.223.88.214 with SMTP id b22mr5562493fam.5.1314634789860; Mon, 29 Aug 2011 09:19:49 -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.152.11.8 with SMTP id m8cs102293lab; Mon, 29 Aug 2011 09:19:49 -0700 (PDT) Received: by 10.14.5.2 with SMTP id 2mr1691346eek.10.1314634787181; Mon, 29 Aug 2011 09:19:47 -0700 (PDT) Received: from mtagate3.uk.ibm.com (mtagate3.uk.ibm.com [194.196.100.163]) by mx.google.com with ESMTPS id m46si1944896eeh.176.2011.08.29.09.19.45 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 29 Aug 2011 09:19:46 -0700 (PDT) Received-SPF: neutral (google.com: 194.196.100.163 is neither permitted nor denied by best guess record for domain of ken.werner@linaro.org) client-ip=194.196.100.163; Authentication-Results: mx.google.com; spf=neutral (google.com: 194.196.100.163 is neither permitted nor denied by best guess record for domain of ken.werner@linaro.org) smtp.mail=ken.werner@linaro.org Received: from d06nrmr1707.portsmouth.uk.ibm.com (d06nrmr1707.portsmouth.uk.ibm.com [9.149.39.225]) by mtagate3.uk.ibm.com (8.13.1/8.13.1) with ESMTP id p7TGJjTh030602 for ; Mon, 29 Aug 2011 16:19:45 GMT Received: from d06av03.portsmouth.uk.ibm.com (d06av03.portsmouth.uk.ibm.com [9.149.37.213]) by d06nrmr1707.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p7TGJjLL2453608 for ; Mon, 29 Aug 2011 17:19:45 +0100 Received: from d06av03.portsmouth.uk.ibm.com (localhost.localdomain [127.0.0.1]) by d06av03.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p7TGJjSc030735 for ; Mon, 29 Aug 2011 10:19:45 -0600 Received: from leonard.boeblingen.de.ibm.com (dyn-9-152-224-36.boeblingen.de.ibm.com [9.152.224.36]) by d06av03.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p7TGJi7p030714; Mon, 29 Aug 2011 10:19:44 -0600 From: Ken Werner To: libunwind-devel@nongnu.org Subject: [PATCH 2/2] ARM: prefer to unwind using DWARF info Date: Mon, 29 Aug 2011 18:19:44 +0200 Message-Id: <1314634784-7847-3-git-send-email-ken.werner@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1314634784-7847-1-git-send-email-ken.werner@linaro.org> References: <1314634784-7847-1-git-send-email-ken.werner@linaro.org> In case the user doesn't specify whether to unwind using the ARM specific unwind tabler or DWARF info libunwind should prefer the latter. Since DWARF expressions are more powerful than the ARM specific unwind tables arm_find_proc_info is changed to check for DWARF first. Signed-off-by: Ken Werner --- src/arm/Gex_tables.c | 32 ++++++++++++++++---------------- 1 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/arm/Gex_tables.c b/src/arm/Gex_tables.c index 5d8c0f4..70ab57c 100644 --- a/src/arm/Gex_tables.c +++ b/src/arm/Gex_tables.c @@ -507,47 +507,47 @@ arm_find_proc_info (unw_addr_space_t as, unw_word_t ip, Debug (14, "looking for IP=0x%lx\n", (long) ip); - if (UNW_TRY_METHOD (UNW_ARM_METHOD_EXIDX)) + if (UNW_TRY_METHOD(UNW_ARM_METHOD_DWARF)) { - struct arm_cb_data cb_data; + struct dwarf_callback_data cb_data; memset (&cb_data, 0, sizeof (cb_data)); cb_data.ip = ip; cb_data.pi = pi; + cb_data.need_unwind_info = need_unwind_info; cb_data.di.format = -1; + cb_data.di_debug.format = -1; SIGPROCMASK (SIG_SETMASK, &unwi_full_mask, &saved_mask); - ret = dl_iterate_phdr (arm_phdr_cb, &cb_data); + ret = dl_iterate_phdr (dwarf_callback, &cb_data); SIGPROCMASK (SIG_SETMASK, &saved_mask, NULL); - if (cb_data.di.format != -1) - ret = tdep_search_unwind_table (as, ip, &cb_data.di, pi, + if (cb_data.single_fde) + /* already got the result in *pi */ + return 0; + + if (cb_data.di_debug.format != -1) + ret = tdep_search_unwind_table (as, ip, &cb_data.di_debug, pi, need_unwind_info, arg); else ret = -UNW_ENOINFO; } - if (ret < 0 && UNW_TRY_METHOD(UNW_ARM_METHOD_DWARF)) + if (ret < 0 && UNW_TRY_METHOD (UNW_ARM_METHOD_EXIDX)) { - struct dwarf_callback_data cb_data; + struct arm_cb_data cb_data; memset (&cb_data, 0, sizeof (cb_data)); cb_data.ip = ip; cb_data.pi = pi; - cb_data.need_unwind_info = need_unwind_info; cb_data.di.format = -1; - cb_data.di_debug.format = -1; SIGPROCMASK (SIG_SETMASK, &unwi_full_mask, &saved_mask); - ret = dl_iterate_phdr (dwarf_callback, &cb_data); + ret = dl_iterate_phdr (arm_phdr_cb, &cb_data); SIGPROCMASK (SIG_SETMASK, &saved_mask, NULL); - if (cb_data.single_fde) - /* already got the result in *pi */ - return 0; - - if (cb_data.di_debug.format != -1) - ret = tdep_search_unwind_table (as, ip, &cb_data.di_debug, pi, + if (cb_data.di.format != -1) + ret = tdep_search_unwind_table (as, ip, &cb_data.di, pi, need_unwind_info, arg); else ret = -UNW_ENOINFO;