From patchwork Tue Oct 11 14:02:39 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ken Werner X-Patchwork-Id: 4630 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 4501C23F58 for ; Tue, 11 Oct 2011 14:02:57 +0000 (UTC) Received: from mail-gx0-f180.google.com (mail-gx0-f180.google.com [209.85.161.180]) by fiordland.canonical.com (Postfix) with ESMTP id F24DDA18365 for ; Tue, 11 Oct 2011 14:02:56 +0000 (UTC) Received: by ggni2 with SMTP id i2so8837186ggn.11 for ; Tue, 11 Oct 2011 07:02:56 -0700 (PDT) Received: by 10.223.85.139 with SMTP id o11mr39791142fal.0.1318341776200; Tue, 11 Oct 2011 07:02:56 -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.24.41 with SMTP id r9cs162229laf; Tue, 11 Oct 2011 07:02:55 -0700 (PDT) Received: by 10.216.82.211 with SMTP id o61mr8125001wee.81.1318341775402; Tue, 11 Oct 2011 07:02:55 -0700 (PDT) Received: from mtagate2.uk.ibm.com (mtagate2.uk.ibm.com. [194.196.100.162]) by mx.google.com with ESMTPS id i8si16358927wed.77.2011.10.11.07.02.55 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 11 Oct 2011 07:02:55 -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 p9BE2qD3007178; Tue, 11 Oct 2011 14:02:52 GMT Received: from d06av10.portsmouth.uk.ibm.com (d06av10.portsmouth.uk.ibm.com [9.149.37.251]) by d06nrmr1307.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p9BE2qA12461828; Tue, 11 Oct 2011 15:02:52 +0100 Received: from d06av10.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av10.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p9BE2l1s021817; Tue, 11 Oct 2011 08:02:47 -0600 Received: from localhost.localdomain (dyn-9-152-224-39.boeblingen.de.ibm.com [9.152.224.39]) by d06av10.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p9BE2jRj021610; Tue, 11 Oct 2011 08:02:47 -0600 From: Ken Werner To: libunwind-devel@nongnu.org Cc: arun@sharma-home.net, harald.servat@bsc.es, Ken Werner Subject: [PATCH] Change _UPTi_find_unwind_table to return an integer. Date: Tue, 11 Oct 2011 16:02:39 +0200 Message-Id: <1318341759-8752-2-git-send-email-ken.werner@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1318341759-8752-1-git-send-email-ken.werner@linaro.org> References: <4E944896.8010501@linaro.org> <1318341759-8752-1-git-send-email-ken.werner@linaro.org> This keeps the definition on IA64 and all the other architectures in sync with the declaration of _UPTi_find_unwind_table. This also mimics the behaviour of what's done for local unwinding and allows the function to provide more than one way to undwind. Signed-off-by: Ken Werner --- src/ptrace/_UPT_find_proc_info.c | 8 ++++---- src/ptrace/_UPT_get_dyn_info_list_addr.c | 6 ++---- src/ptrace/_UPT_internal.h | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/ptrace/_UPT_find_proc_info.c b/src/ptrace/_UPT_find_proc_info.c index 44feb34..7aaa0c2 100644 --- a/src/ptrace/_UPT_find_proc_info.c +++ b/src/ptrace/_UPT_find_proc_info.c @@ -95,7 +95,7 @@ find_gp (struct UPT_info *ui, Elf64_Phdr *pdyn, Elf64_Addr load_base) return gp; } -HIDDEN unw_dyn_info_t * +HIDDEN int _UPTi_find_unwind_table (struct UPT_info *ui, unw_addr_space_t as, char *path, unw_word_t segbase, unw_word_t mapoff, unw_word_t ip) @@ -105,7 +105,7 @@ _UPTi_find_unwind_table (struct UPT_info *ui, unw_addr_space_t as, int i; if (!_Uelf64_valid_object (&ui->ei)) - return NULL; + return -UNW_ENOINFO; ehdr = ui->ei.image; phdr = (Elf64_Phdr *) ((char *) ui->ei.image + ehdr->e_phoff); @@ -132,7 +132,7 @@ _UPTi_find_unwind_table (struct UPT_info *ui, unw_addr_space_t as, } } if (!ptxt || !punw) - return NULL; + return 0; ui->di_cache.start_ip = segbase; ui->di_cache.end_ip = ui->di_cache.start_ip + ptxt->p_memsz; @@ -143,7 +143,7 @@ _UPTi_find_unwind_table (struct UPT_info *ui, unw_addr_space_t as, ui->di_cache.u.ti.table_len = punw->p_memsz / sizeof (unw_word_t); ui->di_cache.u.ti.table_data = (unw_word_t *) ((char *) ui->ei.image + (punw->p_vaddr - ptxt->p_vaddr)); - return &ui->di_cache; + return 1; } #elif UNW_TARGET_X86 || UNW_TARGET_X86_64 || UNW_TARGET_HPPA \ diff --git a/src/ptrace/_UPT_get_dyn_info_list_addr.c b/src/ptrace/_UPT_get_dyn_info_list_addr.c index ba9c795..fdcf56d 100644 --- a/src/ptrace/_UPT_get_dyn_info_list_addr.c +++ b/src/ptrace/_UPT_get_dyn_info_list_addr.c @@ -37,7 +37,6 @@ get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg, struct UPT_info *ui = arg; struct map_iterator mi; char path[PATH_MAX]; - unw_dyn_info_t *di; unw_word_t res; int count = 0; @@ -62,10 +61,9 @@ get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg, Debug (16, "checking object %s\n", path); - di = _UPTi_find_unwind_table (ui, as, path, lo, off, 0); - if (di) + if (_UPTi_find_unwind_table (ui, as, path, lo, off, 0) > 0) { - res = _Uia64_find_dyn_list (as, di, arg); + res = _Uia64_find_dyn_list (as, &ui->di_cache, arg); if (res && count++ == 0) { Debug (12, "dyn_info_list_addr = 0x%lx\n", (long) res); diff --git a/src/ptrace/_UPT_internal.h b/src/ptrace/_UPT_internal.h index 52cc88c..a7a0481 100644 --- a/src/ptrace/_UPT_internal.h +++ b/src/ptrace/_UPT_internal.h @@ -64,7 +64,7 @@ struct UPT_info extern int _UPT_reg_offset[UNW_REG_LAST + 1]; -extern unw_dyn_info_t *UPTi_find_unwind_table (struct UPT_info *ui, +extern int _UPTi_find_unwind_table (struct UPT_info *ui, unw_addr_space_t as, char *path, unw_word_t segbase,