public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
* [SCM]  master: Use only eh_frame data for libunwind get_unwind_table.
@ 2008-01-09  8:50 mark
  0 siblings, 0 replies; only message in thread
From: mark @ 2008-01-09  8:50 UTC (permalink / raw)
  To: frysk-cvs

The branch, master has been updated
       via  ec5496456ceee6f7f3a9b8d1d1784440b8508451 (commit)
      from  62c53ec6561a7145d53727a9e79831fb04df27b9 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit ec5496456ceee6f7f3a9b8d1d1784440b8508451
Author: Mark Wielaard <mwielaard@redhat.com>
Date:   Sat Dec 22 21:16:29 2007 +0100

    Use only eh_frame data for libunwind get_unwind_table.
    
    frysk-imports/libunwind/ChangeLog
    2007-12-22  Mark Wielaard  <mwielaard@redhat.com>
    
           * include/libunwind-common.h.in (unw_get_unwind_table):
           Remove as, arg and peh_vaddr arguments.
           * src/mi/Gget_unwind_table.c (unw_get_unwind_table): Likewise.
           Create address space from eh_frame_accessors. Set rti.table_data
           and rti.segbase from eh_frame_hdr_address. Pass eh_frame_arg
           to tdep_search_unwind_table.
           * src/dwarf/Gfde.c (parse_cie): Add FRYSK LOCAL hack to not
           read personality routine address.
    
    frysk-sys/lib/unwind/ChangeLog
    2007-12-22  Mark Wielaard  <mwielaard@redhat.com>
    
           * cni/UnwindH.hxx (get_eh_frame_hdr_addr): Return char*.
           (createProcInfoFromElfImage): Calculate virtual and adjusted
           addresses from eh_table_hdr and peh_vaddr.

-----------------------------------------------------------------------

Summary of changes:
 frysk-imports/libunwind/ChangeLog                  |   11 +++++++++++
 .../libunwind/include/libunwind-common.h.in        |    6 ++----
 frysk-imports/libunwind/src/dwarf/Gfde.c           |    9 +++++++++
 frysk-imports/libunwind/src/mi/Gget_unwind_table.c |   18 +++++++++---------
 frysk-sys/lib/unwind/ChangeLog                     |    6 ++++++
 frysk-sys/lib/unwind/cni/UnwindH.hxx               |   18 +++++++-----------
 6 files changed, 44 insertions(+), 24 deletions(-)

First 500 lines of diff:
diff --git a/frysk-imports/libunwind/ChangeLog b/frysk-imports/libunwind/ChangeLog
index e09422a..184c9e5 100644
--- a/frysk-imports/libunwind/ChangeLog
+++ b/frysk-imports/libunwind/ChangeLog
@@ -1,3 +1,14 @@
+2007-12-22  Mark Wielaard  <mwielaard@redhat.com>
+
+	* include/libunwind-common.h.in (unw_get_unwind_table):
+	Remove as, arg and peh_vaddr arguments.
+	* src/mi/Gget_unwind_table.c (unw_get_unwind_table): Likewise.
+	Create address space from eh_frame_accessors. Set rti.table_data
+	and rti.segbase from eh_frame_hdr_address. Pass eh_frame_arg
+	to tdep_search_unwind_table.
+	* src/dwarf/Gfde.c (parse_cie): Add FRYSK LOCAL hack to not
+	read personality routine address.
+
 2007-12-20  Mark Wielaard  <mwielaard@redhat.com>
 
 	* configure.in (is_local_frysk_build): New function.
diff --git a/frysk-imports/libunwind/include/libunwind-common.h.in b/frysk-imports/libunwind/include/libunwind-common.h.in
index a837055..b9e582a 100644
--- a/frysk-imports/libunwind/include/libunwind-common.h.in
+++ b/frysk-imports/libunwind/include/libunwind-common.h.in
@@ -250,12 +250,10 @@ extern int unw_get_save_loc (unw_cursor_t *, int, unw_save_loc_t *);
 extern int unw_is_signal_frame (unw_cursor_t *);
 extern int unw_get_proc_name (unw_cursor_t *, char *, size_t, unw_word_t *);
 extern const char *unw_strerror (int);
-extern int unw_get_unwind_table(unw_addr_space_t as, unw_word_t ip, 
+extern int unw_get_unwind_table(unw_word_t ip, 
 				unw_proc_info_t *pi, int need_unwind_info,
-				void *arg,
 				unw_accessors_t *eh_frame_accessors,
 				unw_word_t eh_frame_hdr_address,
-				void *eh_frame_arg,
-				unw_word_t peh_vaddr);
+				void *eh_frame_arg);
 
 extern unw_addr_space_t unw_local_addr_space;
diff --git a/frysk-imports/libunwind/src/dwarf/Gfde.c b/frysk-imports/libunwind/src/dwarf/Gfde.c
index d6b4987..11a6433 100644
--- a/frysk-imports/libunwind/src/dwarf/Gfde.c
+++ b/frysk-imports/libunwind/src/dwarf/Gfde.c
@@ -173,6 +173,15 @@ parse_cie (unw_addr_space_t as, unw_accessors_t *a, unw_word_t addr,
 	/* read the personality-routine pointer-encoding format.  */
 	if ((ret = dwarf_readu8 (as, a, &addr, &handler_encoding, arg)) < 0)
 	  return ret;
+	// FRYSK LOCAL
+	// We never want to actually read the personality routine address
+	// since it can be stored anywhere and currently we are just
+	// feeding it the unwind table data. We still need to read the
+	// encoded pointer to get past it.
+	// Can be restored when frysk feeds the eh_frame through its
+	// main address space.
+	handler_encoding &= ~DW_EH_PE_indirect;
+	// END FRYSK LOCAL
 	if ((ret = dwarf_read_encoded_pointer (as, a, &addr, handler_encoding,
 					       pi, &dci->handler, arg)) < 0)
 	  return ret;
diff --git a/frysk-imports/libunwind/src/mi/Gget_unwind_table.c b/frysk-imports/libunwind/src/mi/Gget_unwind_table.c
index 1d905b6..fc46269 100644
--- a/frysk-imports/libunwind/src/mi/Gget_unwind_table.c
+++ b/frysk-imports/libunwind/src/mi/Gget_unwind_table.c
@@ -26,14 +26,13 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  */
 #include "dwarf-eh.h"
 
 int
-unw_get_unwind_table(unw_addr_space_t as, unw_word_t ip,
-		     unw_proc_info_t *pi, int need_unwind_info, void *arg,
+unw_get_unwind_table(unw_word_t ip, unw_proc_info_t *pi, int need_unwind_info,
 		     unw_accessors_t *eh_frame_accessors,
 		     unw_word_t eh_frame_hdr_address,
-		     void *eh_frame_arg,
-		     unw_word_t peh_vaddr)
+		     void *eh_frame_arg)
 {
   int ret;
+  unw_addr_space_t as = unw_create_addr_space (eh_frame_accessors, 0);
   unw_word_t start = eh_frame_hdr_address;
 
   // Version
@@ -83,11 +82,12 @@ unw_get_unwind_table(unw_addr_space_t as, unw_word_t ip,
   di.u.rti.name_ptr = 0;
   /* two 32-bit values (ip_offset/fde_offset) per table-entry:
      For the binary-search table in the eh_frame_hdr, data-relative
-     means relative to the start of that section...
-     So for now we pass in peh_vaddr and use the main as for access. */
+     means relative to the start of that section... */
   di.u.rti.table_len = (fde_count * 8) / sizeof (unw_word_t);
-  di.u.rti.table_data = peh_vaddr + 12;
-  di.u.rti.segbase = peh_vaddr;
+  di.u.rti.table_data = eh_frame_hdr_address + 12;
+  di.u.rti.segbase = eh_frame_hdr_address;
 
-  return tdep_search_unwind_table (as, ip, &di, pi, need_unwind_info, arg);
+  ret = tdep_search_unwind_table (as, ip, &di, pi, need_unwind_info,
+				  eh_frame_arg);
+  return ret;
 }
diff --git a/frysk-sys/lib/unwind/ChangeLog b/frysk-sys/lib/unwind/ChangeLog
index f93b188..28fa70b 100644
--- a/frysk-sys/lib/unwind/ChangeLog
+++ b/frysk-sys/lib/unwind/ChangeLog
@@ -1,3 +1,9 @@
+2007-12-22  Mark Wielaard  <mwielaard@redhat.com>
+
+	* cni/UnwindH.hxx (get_eh_frame_hdr_addr): Return char*.
+	(createProcInfoFromElfImage): Calculate virtual and adjusted
+	addresses from eh_table_hdr and peh_vaddr.
+	
 2007-12-14  Jose Flavio Aguilar Paulino <joseflavio@gmail.com>
 
 	* GenRegEnum.awk: Add new Awk script to generate the registers
diff --git a/frysk-sys/lib/unwind/cni/UnwindH.hxx b/frysk-sys/lib/unwind/cni/UnwindH.hxx
index 7dbcf7b..e69e031 100644
--- a/frysk-sys/lib/unwind/cni/UnwindH.hxx
+++ b/frysk-sys/lib/unwind/cni/UnwindH.hxx
@@ -446,7 +446,7 @@ lib::unwind::TARGET::getProcInfo(gnu::gcj::RawDataManaged* cursor)
 // Also fills in ip->start_ip, ip->end_ip and ip->gp.
 // peh_vaddr will point to the address of the eh_frame_hdr in the main
 // address space of the inferior.
-static void *
+static char *
 get_eh_frame_hdr_addr(unw_proc_info_t *pi, char *image, size_t size,
 		      unsigned long segbase, unw_word_t *peh_vaddr)
 {
@@ -582,12 +582,10 @@ lib::unwind::TARGET::createProcInfoFromElfImage(lib::unwind::AddressSpace* addre
   unw_proc_info_t *procInfo
     = (::unw_proc_info_t *) JvAllocBytes(sizeof (::unw_proc_info_t));
 
-  unw_addr_space_t as = (unw_addr_space_t) addressSpace->addressSpace;
-
   logFine(this, logger, "Pre unw_get_unwind_table");
   
   unw_word_t peh_vaddr = 0;
-  void *eh_table_hdr = get_eh_frame_hdr_addr(procInfo,
+  char *eh_table_hdr = get_eh_frame_hdr_addr(procInfo,
 					     (char *) elfImage->elfImage,
 					     elfImage->size,
 					     elfImage->segbase,
@@ -602,16 +600,14 @@ lib::unwind::TARGET::createProcInfoFromElfImage(lib::unwind::AddressSpace* addre
   if (eh_table_hdr == NULL)
     return new lib::unwind::ProcInfo(-UNW_ENOINFO);
 
-  int ret = unw_get_unwind_table(as,
-				 (unw_word_t) ip,
+  int ret = unw_get_unwind_table((unw_word_t) ip,
 				 procInfo,
 				 (int) needUnwindInfo,
-				 (void *) addressSpace,
 				 &local_accessors,
-				 0,
-				 eh_table_hdr,
-				 peh_vaddr);
-    
+				 // virtual address
+				 peh_vaddr,
+				 // address adjustment
+				 eh_table_hdr - peh_vaddr);
   
   logFine(this, logger, "Post unw_get_unwind_table");
   lib::unwind::ProcInfo *myInfo;


hooks/post-receive
--
frysk system monitor/debugger


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-01-09  8:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-09  8:50 [SCM] master: Use only eh_frame data for libunwind get_unwind_table mark

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).