From a88af79c9547da3fd80ded7e1fad0ec65a7bfdef Mon Sep 17 00:00:00 2001 From: "mostang.com!davidm" Date: Thu, 24 Apr 2003 20:45:07 +0000 Subject: [PATCH] (_ULia64_local_addr_space): Move to global scope so GCC doesn't whine if we end up not using it. (UNWIND_TBL_32BIT): New macro. (struct unwind_header): Rename "unknown1" member to "header_version". (tdep_find_proc_info) [HAVE_DLMODINFO]: Don't forget to initialize di.gp. Check unwind-header version and format. (Logical change 1.87) --- src/ia64/tables-ia64.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/ia64/tables-ia64.c b/src/ia64/tables-ia64.c index 695ea7aa..034a94fd 100644 --- a/src/ia64/tables-ia64.c +++ b/src/ia64/tables-ia64.c @@ -16,6 +16,8 @@ This file is part of libunwind. */ #include "unwind_i.h" +extern unw_addr_space_t _ULia64_local_addr_space; + struct ia64_table_entry { uint64_t start_offset; @@ -52,8 +54,6 @@ is_local_addr_space (unw_addr_space_t as) #ifdef UNW_REMOTE_ONLY return 0; #else - extern unw_addr_space_t _ULia64_local_addr_space; - return (as == _Uia64_local_addr_space # ifndef UNW_GENERIC_ONLY || as == _ULia64_local_addr_space @@ -405,11 +405,12 @@ tdep_find_proc_info (unw_addr_space_t as, unw_word_t ip, dip = &kernel_table; } #elif defined(HAVE_DLMODINFO) +# define UNWIND_TBL_32BIT 0x8000000000000000 struct load_module_desc lmd; unw_dyn_info_t di, *dip = &di; struct unwind_header { - uint64_t unknown1; + uint64_t header_version; uint64_t start_offset; uint64_t end_offset; } @@ -421,10 +422,26 @@ tdep_find_proc_info (unw_addr_space_t as, unw_word_t ip, di.format = UNW_INFO_FORMAT_TABLE; di.start_ip = lmd.text_base; di.end_ip = lmd.text_base + lmd.text_size; + di.gp = lmd.linkage_ptr; di.u.ti.name_ptr = 0; /* no obvious table-name available */ di.u.ti.segbase = lmd.text_base; uhdr = (struct unwind_header *) lmd.unwind_base; + + if ((uhdr->header_version & ~UNWIND_TBL_32BIT) != 1 + && (uhdr->header_version & ~UNWIND_TBL_32BIT) != 2) + { + debug (1, "%s: encountered unknown unwind header version %ld\n", + __FUNCTION__, (long) (uhdr->header_version & ~UNWIND_TBL_32BIT)); + return -UNW_EBADVERSION; + } + if (uhdr->header_version & UNWIND_TBL_32BIT) + { + debug (1, "%s: 32-bit unwind tables are not supported yet\n", + __FUNCTION__); + return -UNW_EINVAL; + } + di.u.ti.table_data = (unw_word_t *) (di.u.ti.segbase + uhdr->start_offset); di.u.ti.table_len = ((uhdr->end_offset - uhdr->start_offset) / sizeof (unw_word_t));