public inbox for frysk@sourceware.org
 help / color / mirror / Atom feed
* New Libunwind for Power Fix
@ 2007-10-11 16:36 Jose Flavio Aguilar Paulino
  2007-10-13 14:19 ` Mark Wielaard
  0 siblings, 1 reply; 2+ messages in thread
From: Jose Flavio Aguilar Paulino @ 2007-10-11 16:36 UTC (permalink / raw)
  To: Frysk

[-- Attachment #1: Type: text/plain, Size: 322 bytes --]

This patch fix the libunwind that was recently imported.
Through this libunwind can properly compile for Power64 and Power32.
It's necessary run autoreconf in libunwind.

best regards,

-- 
Jose Flavio Aguilar Paulino
(jflavio@br.ibm.com)
System / Software Engineer

Toolchain Team
LTC, Linux Technology Center
IBM Brazil

[-- Attachment #2: frysk_libunwind_4_power --]
[-- Type: text/x-patch, Size: 7365 bytes --]

Index: frysk/frysk-imports/libunwind/include/tdep-ppc32/libunwind_i.h
===================================================================
--- frysk.orig/frysk-imports/libunwind/include/tdep-ppc32/libunwind_i.h
+++ frysk/frysk-imports/libunwind/include/tdep-ppc32/libunwind_i.h
@@ -255,6 +255,7 @@ dwarf_put (struct dwarf_cursor *c, dwarf
 #define tdep_get_elf_image		UNW_ARCH_OBJ(get_elf_image)
 #define tdep_access_reg			UNW_OBJ(access_reg)
 #define tdep_access_fpreg		UNW_OBJ(access_fpreg)
+#define tdep_fetch_proc_info_post       UNW_OBJ(fetch_proc_info_post)
 #define tdep_get_func_addr		UNW_OBJ(get_func_addr)
 
 #ifdef UNW_LOCAL_ONLY
@@ -287,8 +288,10 @@ extern int tdep_search_unwind_table (unw
 				     unw_proc_info_t * pi,
 				     int need_unwind_info, void *arg);
 extern void *tdep_uc_addr (ucontext_t * uc, int reg);
-extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip,
-			       unsigned long *segbase, unsigned long *mapoff);
+extern int tdep_get_elf_image (unw_addr_space_t as, struct elf_image *ei,
+			       pid_t pid, unw_word_t ip,
+			       unsigned long *segbase, unsigned long *mapoff,
+			       void *arg);
 extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg,
 			    unw_word_t * valp, int write);
 extern int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg,
Index: frysk/frysk-imports/libunwind/include/tdep-ppc64/libunwind_i.h
===================================================================
--- frysk.orig/frysk-imports/libunwind/include/tdep-ppc64/libunwind_i.h
+++ frysk/frysk-imports/libunwind/include/tdep-ppc64/libunwind_i.h
@@ -255,6 +255,7 @@ dwarf_put (struct dwarf_cursor *c, dwarf
 #define tdep_get_elf_image		UNW_ARCH_OBJ(get_elf_image)
 #define tdep_access_reg			UNW_OBJ(access_reg)
 #define tdep_access_fpreg		UNW_OBJ(access_fpreg)
+#define tdep_fetch_proc_info_post       UNW_OBJ(fetch_proc_info_post)
 #define tdep_get_func_addr		UNW_OBJ(get_func_addr)
 
 #ifdef UNW_LOCAL_ONLY
@@ -287,8 +288,9 @@ extern int tdep_search_unwind_table (unw
 				     unw_proc_info_t * pi,
 				     int need_unwind_info, void *arg);
 extern void *tdep_uc_addr (ucontext_t * uc, int reg);
-extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip,
-			       unsigned long *segbase, unsigned long *mapoff);
+extern int tdep_get_elf_image (unw_addr_space_t as, struct elf_image *ei, pid_t pid,
+			       unw_word_t ip, unsigned long *segbase,
+			       unsigned long *mapoff, void *arg);
 extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg,
 			    unw_word_t * valp, int write);
 extern int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg,
Index: frysk/frysk-imports/libunwind/src/Makefile.am
===================================================================
--- frysk.orig/frysk-imports/libunwind/src/Makefile.am
+++ frysk/frysk-imports/libunwind/src/Makefile.am
@@ -207,12 +207,14 @@ libunwind_x86_64_la_SOURCES_x86_64 = $(l
 # The list of local files that go to Power 64 and 32:
 libunwind_la_SOURCES_ppc = ppc/Lcreate_addr_space.c 			\
 	ppc/Lget_proc_info.c ppc/Lget_save_loc.c ppc/Linit_local.c	\
-	ppc/Linit_remote.c ppc/Lis_signal_frame.c
+	ppc/Linit_remote.c ppc/Lis_signal_frame.c			\
+	ppc/Lfetch_proc_info_post.c
 
 # The list of generic files that go to Power 64 and 32:
 libunwind_ppc_la_SOURCES_ppc_generic = ppc/Gcreate_addr_space.c		\
 	ppc/Gget_proc_info.c ppc/Gget_save_loc.c ppc/Ginit_local.c	\
-	ppc/Ginit_remote.c ppc/Gis_signal_frame.c
+	ppc/Ginit_remote.c ppc/Gis_signal_frame.c			\
+	ppc/Gfetch_proc_info_post.c
 
 # The list of files that go both into libunwind and libunwind-ppc32:
 libunwind_la_SOURCES_ppc32_common = $(libunwind_la_SOURCES_common)      \
Index: frysk/frysk-imports/libunwind/src/ppc/Gfetch_proc_info_post.c
===================================================================
--- /dev/null
+++ frysk/frysk-imports/libunwind/src/ppc/Gfetch_proc_info_post.c
@@ -0,0 +1,51 @@
+/* libunwind - a platform-independent unwind library
+   Copyright (c) 2006 Hewlett-Packard Development Company, L.P.
+	Contributed by Jan Kratochvil <jan.kratochvil@redhat.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  */
+
+#include "libunwind_i.h"
+
+HIDDEN int
+tdep_fetch_proc_info_post (struct dwarf_cursor *c, unw_word_t ip, int need_unwind_info)
+{
+  struct cursor *cursor = (struct cursor *) c;
+
+  /* Should happen only if `!need_unwind_info'.  */
+  if (!c->pi_valid)
+    return 0;
+  /* Should happen only if `!need_unwind_info'.  */
+  if (!c->pi.unwind_info)
+    return 0;
+
+  /* Reset the value for this frame.  */
+  cursor->sigcontext_format = PPC_SCF_NONE;
+
+  /* Normal non-signal frames case.  */
+  if (!((struct dwarf_cie_info *) c->pi.unwind_info)->signal_frame)
+    return 0;
+
+  cursor->sigcontext_format = PPC_SCF_LINUX_RT_SIGFRAME;
+  cursor->sigcontext_addr = c->cfa + 4;
+
+  return 0;
+}
Index: frysk/frysk-imports/libunwind/src/ppc/Lfetch_proc_info_post.c
===================================================================
--- /dev/null
+++ frysk/frysk-imports/libunwind/src/ppc/Lfetch_proc_info_post.c
@@ -0,0 +1,5 @@
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
+#include "Gfetch_proc_info_post.c"
+#endif
Index: frysk/frysk-imports/libunwind/src/ppc32/Ginit.c
===================================================================
--- frysk.orig/frysk-imports/libunwind/src/ppc32/Ginit.c
+++ frysk/frysk-imports/libunwind/src/ppc32/Ginit.c
@@ -199,7 +199,7 @@ get_static_proc_name (unw_addr_space_t a
 		      char *buf, size_t buf_len, unw_word_t *offp,
 		      void *arg)
 {
-  return _Uelf32_get_proc_name (as, getpid (), ip, buf, buf_len, offp);
+  return _Uelf32_get_proc_name (as, getpid (), ip, buf, buf_len, offp, arg);
 }
 
 HIDDEN void
Index: frysk/frysk-imports/libunwind/src/ppc64/Ginit.c
===================================================================
--- frysk.orig/frysk-imports/libunwind/src/ppc64/Ginit.c
+++ frysk/frysk-imports/libunwind/src/ppc64/Ginit.c
@@ -208,7 +208,7 @@ get_static_proc_name (unw_addr_space_t a
 		      char *buf, size_t buf_len, unw_word_t *offp,
 		      void *arg)
 {
-  return _Uelf64_get_proc_name (as, getpid (), ip, buf, buf_len, offp);
+  return _Uelf64_get_proc_name (as, getpid (), ip, buf, buf_len, offp, arg);
 }
 
 HIDDEN void

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: New Libunwind for Power Fix
  2007-10-11 16:36 New Libunwind for Power Fix Jose Flavio Aguilar Paulino
@ 2007-10-13 14:19 ` Mark Wielaard
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Wielaard @ 2007-10-13 14:19 UTC (permalink / raw)
  To: Jose Flavio Aguilar Paulino; +Cc: Frysk

Hi Jose,

On Thu, 2007-10-11 at 13:35 -0300, Jose Flavio Aguilar Paulino wrote:
> This patch fix the libunwind that was recently imported.
> Through this libunwind can properly compile for Power64 and Power32.

Thanks! I added these patches as follows:

frysk-imports/libunwind/ChangeLog:
2007-10-12  Jose Flavio Aguilar Paulino  <jflavio@br.ibm.com>

  * include/tdep-ppc32/libunwind_i.h: Define tdep_fetch_proc_info_post.
  (tdep_get_elf_image): Add void *arg argument.
  * include/tdep-ppc64/libunwind_i.h: Likewise.
  * src/Makefile.am (libunwind_la_SOURCES_ppc): Add
  ppc/Lfetch_proc_info_post.c.
  (libunwind_ppc_la_SOURCES_ppc_generic): Add
  ppc/Gfetch_proc_info_post.c.
  * src/ppc/Gfetch_proc_info_post.c: New file.
  * src/ppc/Lfetch_proc_info_post.c: New file.
  * src/ppc32/Ginit.c (get_static_proc_name): Pass through arg.
  * src/ppc64/Ginit.c (get_static_proc_name): Likewise.

I also added ppc32 as proper libunwind target in the frysk build so
things get configured and build properly by default now:

frysk-imports/ChangeLog:
2007-10-12  Mark Wielaard  <mwielaard@redhat.com>

  * Makefile.am: Set LIBUNWIND_ARCH_DIR, LIBUNWIND_OTHER_DIRS and
  GEN_GCJ_LDADD_LIST to include ppc32 target.
  * bootstrap.sh: Add ppc32 to isa list.

common/ChangeLog:
2007-10-12  Mark Wielaard  <mwielaard@redhat.com>

  * m4/frysk-use-libunwind.m4: Check for and transform powerpc target
  to ppc32.

frysk-imports/libunwind/ChangeLog:
2007-10-12  Mark Wielaard  <mwielaard@redhat.com>

  * src/ppc32/ucontext_i.h: Use locally defined reg structs.

As you see I had to add a similar patch to ppc32/ucontext_i.h that I
send you for ppc64/ucontext_i.h earlier because we want to be able to
compile for targets on hosts that might not have the kernel headers with
those structures in them available. Please do double check, I didn't
have a ppc machine available to test.

On each target you can build frysk with --enable-check-libunwind which
will build the tests for that particular target for a make check that
you can then compare with libunwind upstream results. They should be
fairly comparable (modulo a few extra/adjusted tests in frysk).
See http://sourceware.org/ml/frysk/2007-q4/msg00022.html

To complete unwinding/stack support in frysk for ppc some more work is
necessary:

- frysk-sys/lib/unwind and cni support should be added.
  This isn't particularly hard, see the existing
  UnwindRegisters[X86].shenum,shjava and cni/Unwind[X86].cxx examples.
  Just need to make sure that the right mappings to/from registers and
  the right libunwind target is selected.
- frysk-core/frysk/stack/LibunwindAddressSpace.java
  Should select the right unwind target (has hardcoded dependencies on
  x86/x86_64 currently).
- frysk-core/frys/isa/ Registers and frysk-core/frysk/proc Task should
  have the correct register names, register banks and selection.
  Andrew is currently reorganizing this code (see his recent messages
  to the list).

Cheers,

Mark

P.S. I will be without internet access for a couple of days, so I might
take a while to respond to questions.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-10-13 14:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-11 16:36 New Libunwind for Power Fix Jose Flavio Aguilar Paulino
2007-10-13 14:19 ` Mark Wielaard

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).