From 503ff15d3831702b6020a5e0f37540cbd41c77d2 Mon Sep 17 00:00:00 2001 From: Kevin Buettner Date: Sat, 13 Dec 2003 03:51:56 +0000 Subject: [PATCH] From David Mosberger : * libunwind-frame.c (unw_find_dyn_list_p): Replace most arguments with a single unw_dyn_info_t pointer. (libunwind_find_dyn_list): Likewise. * libunwind-frame.h: Likewise. * ia64-tdep.c (ia64_find_unwind_table): Switch to using UNW_INFO_FORMAT_REMOTE_TABLE so we can avoid having to read in the entire unwind-table at once. Support for this table format has been added to libunwind v0.95. (ia64_find_proc_info_x): Adjust for remote-unwind-table changes. (ia64_get_dyn_info_list): Adjust for interface change for libunwind_find_dyn_list(). --- gdb/ChangeLog | 15 ++++++++++++ gdb/ia64-tdep.c | 53 ++++++++++++++++++++----------------------- gdb/libunwind-frame.c | 11 ++++----- gdb/libunwind-frame.h | 6 ++--- 4 files changed, 47 insertions(+), 38 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 862c048c54b..a7d30b8ab91 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,18 @@ +2003-12-12 Kevin Buettner + + From David Mosberger : + * libunwind-frame.c (unw_find_dyn_list_p): Replace most arguments + with a single unw_dyn_info_t pointer. + (libunwind_find_dyn_list): Likewise. + * libunwind-frame.h: Likewise. + * ia64-tdep.c (ia64_find_unwind_table): Switch to using + UNW_INFO_FORMAT_REMOTE_TABLE so we can avoid having to read in the + entire unwind-table at once. Support for this table format has + been added to libunwind v0.95. + (ia64_find_proc_info_x): Adjust for remote-unwind-table changes. + (ia64_get_dyn_info_list): Adjust for interface change for + libunwind_find_dyn_list(). + 2003-12-12 Jeff Johnston * breakpoint.c (breakpoint_enabled): New function to test whether diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c index 19f18b7faa1..88e0e20c072 100644 --- a/gdb/ia64-tdep.c +++ b/gdb/ia64-tdep.c @@ -2452,23 +2452,11 @@ ia64_find_unwind_table (struct objfile *objfile, unw_word_t ip, dip->start_ip = segbase; dip->end_ip = dip->start_ip + p_text->p_memsz; dip->gp = FIND_GLOBAL_POINTER (ip); - dip->format = UNW_INFO_FORMAT_TABLE; - dip->u.ti.name_ptr = (unw_word_t) bfd_get_filename (bfd); - dip->u.ti.segbase = segbase; - dip->u.ti.table_len = p_unwind->p_memsz / sizeof (unw_word_t); - - /* The following can happen in corner cases where dynamically - generated code falls into the same page that contains the - data-segment and the page-offset of the code is within the first - page of the executable. */ - if (ip < dip->start_ip || ip >= dip->end_ip) - return -UNW_ENOINFO; - - /* Read in the libunwind table. */ - *buf = xmalloc (p_unwind->p_memsz); - target_read_memory (p_unwind->p_vaddr + load_base, (char *)(*buf), p_unwind->p_memsz); - - dip->u.ti.table_data = (unw_word_t *)(*buf); + dip->format = UNW_INFO_FORMAT_REMOTE_TABLE; + dip->u.rti.name_ptr = (unw_word_t) bfd_get_filename (bfd); + dip->u.rti.segbase = segbase; + dip->u.rti.table_len = p_unwind->p_memsz / sizeof (unw_word_t); + dip->u.rti.table_data = p_unwind->p_vaddr + load_base; return 0; } @@ -2490,22 +2478,32 @@ ia64_find_proc_info_x (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi, version. */ if (get_kernel_table (ip, &di) < 0) return -UNW_ENOINFO; + + if (gdbarch_debug >= 1) + fprintf_unfiltered (gdb_stdlog, "%s: %lx -> " + "(name=`%s',segbase=%lx,start=%lx,end=%lx,gp=%lx," + "length=%lu,data=%p)\n", __FUNCTION__, + ip, (char *)di.u.ti.name_ptr, + di.u.ti.segbase, di.start_ip, di.end_ip, + di.gp, di.u.ti.table_len, di.u.ti.table_data); } else { ret = ia64_find_unwind_table (sec->objfile, ip, &di, &buf); if (ret < 0) return ret; - } - if (gdbarch_debug >= 1) - fprintf_unfiltered (gdb_stdlog, "acquire_unwind_info: %lx -> " - "(name=`%s',segbase=%lx,start=%lx,end=%lx,gp=%lx," - "length=%lu,data=%p)\n", ip, (char *)di.u.ti.name_ptr, - di.u.ti.segbase, di.start_ip, di.end_ip, - di.gp, di.u.ti.table_len, di.u.ti.table_data); + if (gdbarch_debug >= 1) + fprintf_unfiltered (gdb_stdlog, "%s: %lx -> " + "(name=`%s',segbase=%lx,start=%lx,end=%lx,gp=%lx," + "length=%lu,data=%lx)\n", __FUNCTION__, + ip, (char *)di.u.rti.name_ptr, + di.u.rti.segbase, di.start_ip, di.end_ip, + di.gp, di.u.rti.table_len, di.u.rti.table_data); + } - ret = libunwind_search_unwind_table (&as, ip, &di, pi, need_unwind_info, arg); + ret = libunwind_search_unwind_table (&as, ip, &di, pi, need_unwind_info, + arg); /* We no longer need the dyn info storage so free it. */ xfree (buf); @@ -2545,10 +2543,7 @@ ia64_get_dyn_info_list (unw_addr_space_t as, ret = ia64_find_unwind_table (objfile, ip, &di, &buf); if (ret >= 0) { - addr = libunwind_find_dyn_list (as, di.u.ti.table_data, - (di.u.ti.table_len - * sizeof (di.u.ti.table_data[0])), - di.u.ti.segbase, di.gp, arg); + addr = libunwind_find_dyn_list (as, &di, arg); /* We no longer need the dyn info storage so free it. */ xfree (buf); diff --git a/gdb/libunwind-frame.c b/gdb/libunwind-frame.c index d23ec56057e..bf0c36d9f60 100644 --- a/gdb/libunwind-frame.c +++ b/gdb/libunwind-frame.c @@ -58,8 +58,8 @@ static int (*unw_init_remote_p) (unw_cursor_t *, unw_addr_space_t, void *); static unw_addr_space_t (*unw_create_addr_space_p) (unw_accessors_t *, int); static int (*unw_search_unwind_table_p) (unw_addr_space_t, unw_word_t, unw_dyn_info_t *, unw_proc_info_t *, int, void *); -static unw_word_t (*unw_find_dyn_list_p) (unw_addr_space_t, void *, size_t, - unw_word_t, unw_word_t, void *); +static unw_word_t (*unw_find_dyn_list_p) (unw_addr_space_t, unw_dyn_info_t *, + void *); struct libunwind_frame_cache @@ -170,11 +170,10 @@ libunwind_frame_cache (struct frame_info *next_frame, void **this_cache) return cache; } -unw_word_t -libunwind_find_dyn_list (unw_addr_space_t as, void *table, size_t table_size, - unw_word_t segbase, unw_word_t gp, void *arg) +unw_word_t +libunwind_find_dyn_list (unw_addr_space_t as, unw_dyn_info_t *di, void *arg) { - return unw_find_dyn_list_p (as, table, table_size, segbase, gp, arg); + return unw_find_dyn_list_p (as, di, arg); } static const struct frame_unwind libunwind_frame_unwind = diff --git a/gdb/libunwind-frame.h b/gdb/libunwind-frame.h index c151ef9ab71..bacdf87a49a 100644 --- a/gdb/libunwind-frame.h +++ b/gdb/libunwind-frame.h @@ -55,9 +55,9 @@ int libunwind_is_initialized (void); int libunwind_search_unwind_table (void *as, long ip, void *di, void *pi, int need_unwind_info, void *args); -unw_word_t libunwind_find_dyn_list (unw_addr_space_t, void *, size_t, - unw_word_t, unw_word_t, void *); - +unw_word_t libunwind_find_dyn_list (unw_addr_space_t, unw_dyn_info_t *, + void *); + #endif /* libunwind-frame.h */ #endif /* HAVE_LIBUNWIND_H */ -- 2.30.2