Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Enable DWARF-2 frames on S/390
@ 2004-02-18 16:45 Ulrich Weigand
  2004-02-26 20:58 ` Andrew Cagney
  0 siblings, 1 reply; 5+ messages in thread
From: Ulrich Weigand @ 2004-02-18 16:45 UTC (permalink / raw)
  To: gdb-patches

Hello,

now that all pieces of the DWARF-2 CFI rework have gone in, and
the big s390 backend reorganization was also committed, this patch
is the only thing that's missing to enable DWARF-2 frame support
on s390.

Do you think a copyright assignment is required for this?  While
it's longer than 10 lines, it doesn't really contain anything
that should be significant w.r.t. intellectual property -- the
s390_dwarf2_frame_init_reg routine only implements the publicly
documented s390 ABI calling convention ...

Tested on s390-ibm-linux and s390x-ibm-linux.

Bye,
Ulrich

ChangeLog:

	* s390-tdep.c: Include "dwarf2-frame.h".
	(s390_dwarf2_frame_init_reg): New function.
	(s390_gdbarch_init): Install dwarf2_frame_sniffer and
	dwarf2_frame_base_sniffer.  Call dwarf2_frame_set_init_reg.
	* Makefile.in (s390-tdep.o): Update dependencies.

diff -c -p -r gdb-head/gdb/Makefile.in gdb-head-new/gdb/Makefile.in
*** gdb-head/gdb/Makefile.in	Wed Feb 18 05:17:34 2004
--- gdb-head-new/gdb/Makefile.in	Wed Feb 18 16:27:02 2004
*************** s390-nat.o: s390-nat.c $(defs_h) $(tm_h)
*** 2181,2187 ****
  s390-tdep.o: s390-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) $(inferior_h) \
  	$(symtab_h) $(target_h) $(gdbcore_h) $(gdbcmd_h) $(symfile_h) \
  	$(objfiles_h) $(tm_h) $(__bfd_bfd_h) $(floatformat_h) $(regcache_h) \
! 	$(trad_frame_h) $(frame_base_h) $(frame_unwind_h) \
  	$(reggroups_h) $(regset_h) $(value_h) $(gdb_assert_h) $(dis_asm_h) \
  	$(solib_svr4_h) $(s390_tdep_h)
  scm-exp.o: scm-exp.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \
--- 2181,2187 ----
  s390-tdep.o: s390-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) $(inferior_h) \
  	$(symtab_h) $(target_h) $(gdbcore_h) $(gdbcmd_h) $(symfile_h) \
  	$(objfiles_h) $(tm_h) $(__bfd_bfd_h) $(floatformat_h) $(regcache_h) \
! 	$(trad_frame_h) $(frame_base_h) $(frame_unwind_h) $(dwarf2_frame_h) \
  	$(reggroups_h) $(regset_h) $(value_h) $(gdb_assert_h) $(dis_asm_h) \
  	$(solib_svr4_h) $(s390_tdep_h)
  scm-exp.o: scm-exp.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \
diff -c -p -r gdb-head/gdb/s390-tdep.c gdb-head-new/gdb/s390-tdep.c
*** gdb-head/gdb/s390-tdep.c	Wed Feb 18 05:17:35 2004
--- gdb-head-new/gdb/s390-tdep.c	Wed Feb 18 16:22:46 2004
***************
*** 38,43 ****
--- 38,44 ----
  #include "trad-frame.h"
  #include "frame-base.h"
  #include "frame-unwind.h"
+ #include "dwarf2-frame.h"
  #include "reggroups.h"
  #include "regset.h"
  #include "value.h"
*************** s390_unwind_sp (struct gdbarch *gdbarch,
*** 2298,2303 ****
--- 2299,2351 ----
  }
  
  
+ /* DWARF-2 frame support.  */
+ 
+ static void
+ s390_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum,
+                             struct dwarf2_frame_state_reg *reg)
+ {
+   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ 
+   switch (tdep->abi)
+     {
+     case ABI_LINUX_S390:
+       /* Call-saved registers.  */
+       if ((regnum >= S390_R6_REGNUM && regnum <= S390_R15_REGNUM)
+ 	  || regnum == S390_F4_REGNUM
+ 	  || regnum == S390_F6_REGNUM)
+ 	reg->how = DWARF2_FRAME_REG_SAME_VALUE;
+ 
+       /* Call-clobbered registers.  */
+       else if ((regnum >= S390_R0_REGNUM && regnum <= S390_R5_REGNUM)
+ 	       || (regnum >= S390_F0_REGNUM && regnum <= S390_F15_REGNUM
+ 		   && regnum != S390_F4_REGNUM && regnum != S390_F6_REGNUM))
+ 	reg->how = DWARF2_FRAME_REG_UNDEFINED;
+ 
+       /* The return address column.  */
+       else if (regnum == S390_PC_REGNUM)
+ 	reg->how = DWARF2_FRAME_REG_RA;
+       break;
+ 
+     case ABI_LINUX_ZSERIES:
+       /* Call-saved registers.  */
+       if ((regnum >= S390_R6_REGNUM && regnum <= S390_R15_REGNUM)
+ 	  || (regnum >= S390_F8_REGNUM && regnum <= S390_F15_REGNUM))
+ 	reg->how = DWARF2_FRAME_REG_SAME_VALUE;
+ 
+       /* Call-clobbered registers.  */
+       else if ((regnum >= S390_R0_REGNUM && regnum <= S390_R5_REGNUM)
+ 	       || (regnum >= S390_F0_REGNUM && regnum <= S390_F7_REGNUM))
+ 	reg->how = DWARF2_FRAME_REG_UNDEFINED;
+ 
+       /* The return address column.  */
+       else if (regnum == S390_PC_REGNUM)
+ 	reg->how = DWARF2_FRAME_REG_RA;
+       break;
+     }
+ }
+ 
+ 
  /* Dummy function calls.  */
  
  /* Return non-zero if TYPE is an integer-like type, zero otherwise.
*************** s390_gdbarch_init (struct gdbarch_info i
*** 2977,2982 ****
--- 3025,3033 ----
  
    /* Frame handling.  */
    set_gdbarch_in_solib_call_trampoline (gdbarch, in_plt_section);
+   dwarf2_frame_set_init_reg (gdbarch, s390_dwarf2_frame_init_reg);
+   frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
+   frame_base_append_sniffer (gdbarch, dwarf2_frame_base_sniffer);
    frame_unwind_append_sniffer (gdbarch, s390_pltstub_frame_sniffer);
    frame_unwind_append_sniffer (gdbarch, s390_sigtramp_frame_sniffer);
    frame_unwind_append_sniffer (gdbarch, s390_frame_sniffer);
-- 
  Dr. Ulrich Weigand
  weigand@informatik.uni-erlangen.de


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

* Re: [PATCH] Enable DWARF-2 frames on S/390
  2004-02-18 16:45 [PATCH] Enable DWARF-2 frames on S/390 Ulrich Weigand
@ 2004-02-26 20:58 ` Andrew Cagney
  2004-02-26 23:03   ` Ulrich Weigand
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Cagney @ 2004-02-26 20:58 UTC (permalink / raw)
  To: Ulrich Weigand; +Cc: gdb-patches

> Hello,
> 
> now that all pieces of the DWARF-2 CFI rework have gone in, and
> the big s390 backend reorganization was also committed, this patch
> is the only thing that's missing to enable DWARF-2 frame support
> on s390.
> 
> Do you think a copyright assignment is required for this?  While
> it's longer than 10 lines, it doesn't really contain anything
> that should be significant w.r.t. intellectual property -- the
> s390_dwarf2_frame_init_reg routine only implements the publicly
> documented s390 ABI calling convention ...

Can you describe the change with one paragraph of english?

Andrew



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

* Re: [PATCH] Enable DWARF-2 frames on S/390
  2004-02-26 20:58 ` Andrew Cagney
@ 2004-02-26 23:03   ` Ulrich Weigand
  2004-02-26 23:48     ` Andrew Cagney
  0 siblings, 1 reply; 5+ messages in thread
From: Ulrich Weigand @ 2004-02-26 23:03 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: Ulrich Weigand, gdb-patches

Hello Andrew,

> > now that all pieces of the DWARF-2 CFI rework have gone in, and
> > the big s390 backend reorganization was also committed, this patch
> > is the only thing that's missing to enable DWARF-2 frame support
> > on s390.
> > 
> > Do you think a copyright assignment is required for this?  While
> > it's longer than 10 lines, it doesn't really contain anything
> > that should be significant w.r.t. intellectual property -- the
> > s390_dwarf2_frame_init_reg routine only implements the publicly
> > documented s390 ABI calling convention ...
> 
> Can you describe the change with one paragraph of english?

The change consists of installing a dwarf2_frame_set_init_reg
callback that overrides the default register state initializtion
to instead perform the following: set all call-saved registers to 
DWARF2_FRAME_REG_SAME_VALUE, all call-clobbered registers to
DWARF2_FRAME_REG_UNDEFINED, and the virtual PC register to
DWARF2_FRAME_REG_RA.  Which registers count as call-saved vs.
call-clobbered is defined by the Linux for S/390 and Linux for
zSeries ABI documents.

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  weigand@informatik.uni-erlangen.de


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

* Re: [PATCH] Enable DWARF-2 frames on S/390
  2004-02-26 23:03   ` Ulrich Weigand
@ 2004-02-26 23:48     ` Andrew Cagney
  2004-02-27  1:46       ` Ulrich Weigand
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Cagney @ 2004-02-26 23:48 UTC (permalink / raw)
  To: Ulrich Weigand; +Cc: gdb-patches

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

> The change consists of installing a dwarf2_frame_set_init_reg
> callback that overrides the default register state initializtion
> to instead perform the following: set all call-saved registers to 
> DWARF2_FRAME_REG_SAME_VALUE, all call-clobbered registers to
> DWARF2_FRAME_REG_UNDEFINED, and the virtual PC register to
> DWARF2_FRAME_REG_RA.  Which registers count as call-saved vs.
> call-clobbered is defined by the Linux for S/390 and Linux for
> zSeries ABI documents.

Ok, I've committed the attached.

Andrew


[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 5791 bytes --]

Index: ChangeLog
2004-02-26  Andrew Cagney  <cagney@redhat.com>

	* Makefile.in: Update dependencies.
	Changes from Ulrich Weigand,
	* s390-tdep.c: Include "dwarf2-frame.h".
	(s390_dwarf2_frame_init_reg): New function.
	(s390_gdbarch_init): Install dwarf2_frame_sniffer and
	dwarf2_frame_base_sniffer.  Call dwarf2_frame_set_init_reg.

Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.516
diff -u -r1.516 Makefile.in
--- Makefile.in	25 Feb 2004 20:45:30 -0000	1.516
+++ Makefile.in	26 Feb 2004 23:34:23 -0000
@@ -617,7 +617,9 @@
 ada_lang_h = ada-lang.h $(value_h) $(gdbtypes_h)
 alphabsd_tdep_h = alphabsd-tdep.h
 alpha_tdep_h = alpha-tdep.h
+amd64_linux_tdep_h = amd64-linux-tdep.h
 amd64_nat_h = amd64-nat.h
+amd64_tdep_h = amd64-tdep.h $(i386_tdep_h)
 annotate_h = annotate.h $(symtab_h) $(gdbtypes_h)
 arch_utils_h = arch-utils.h
 arm_tdep_h = arm-tdep.h
@@ -770,8 +772,6 @@
 version_h = version.h
 wince_stub_h = wince-stub.h
 wrapper_h = wrapper.h $(gdb_h)
-amd64_linux_tdep_h = amd64-linux-tdep.h
-amd64_tdep_h = amd64-tdep.h $(i386_tdep_h)
 xcoffsolib_h = xcoffsolib.h
 xmodem_h = xmodem.h
 
@@ -1532,9 +1532,9 @@
 	$(regcache_h) $(linux_nat_h) $(gdb_assert_h) $(gdb_string_h) \
 	$(gdb_proc_service_h) $(gregset_h) $(amd64_tdep_h) \
 	$(amd64_linux_tdep_h) $(i386_linux_tdep_h) $(amd64_nat_h)
-amd64-linux-tdep.o: amd64-linux-tdep.c $(defs_h) $(inferior_h) \
-	$(gdbcore_h) $(regcache_h) $(osabi_h) $(gdb_string_h) \
-	$(amd64_tdep_h) $(amd64_linux_tdep_h)
+amd64-linux-tdep.o: amd64-linux-tdep.c $(defs_h) $(inferior_h) $(gdbcore_h) \
+	$(regcache_h) $(osabi_h) $(gdb_string_h) $(amd64_tdep_h) \
+	$(amd64_linux_tdep_h)
 amd64-nat.o: amd64-nat.c $(defs_h) $(gdbarch_h) $(regcache_h) \
 	$(gdb_assert_h) $(i386_tdep_h) $(amd64_tdep_h)
 amd64nbsd-nat.o: amd64nbsd-nat.c $(defs_h) $(gdb_assert_h) $(amd64_tdep_h) \
@@ -1892,7 +1892,7 @@
 ia64-linux-nat.o: ia64-linux-nat.c $(defs_h) $(gdb_string_h) $(inferior_h) \
 	$(target_h) $(gdbcore_h) $(regcache_h) $(gdb_wait_h) $(gregset_h)
 ia64-linux-tdep.o: ia64-linux-tdep.c $(defs_h) $(ia64_tdep_h) \
-	$(arch_utils_h) $(gdbcore_h)
+	$(arch_utils_h) $(gdbcore_h) $(regcache_h)
 ia64-tdep.o: ia64-tdep.c $(defs_h) $(inferior_h) $(gdbcore_h) \
 	$(arch_utils_h) $(floatformat_h) $(regcache_h) $(reggroups_h) \
 	$(frame_h) $(frame_base_h) $(frame_unwind_h) $(doublest_h) \
@@ -2247,9 +2247,9 @@
 s390-tdep.o: s390-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) $(inferior_h) \
 	$(symtab_h) $(target_h) $(gdbcore_h) $(gdbcmd_h) $(objfiles_h) \
 	$(tm_h) $(__bfd_bfd_h) $(floatformat_h) $(regcache_h) \
-	$(trad_frame_h) $(frame_base_h) $(frame_unwind_h) $(reggroups_h) \
-	$(regset_h) $(value_h) $(gdb_assert_h) $(dis_asm_h) $(solib_svr4_h) \
-	$(s390_tdep_h)
+	$(trad_frame_h) $(frame_base_h) $(frame_unwind_h) $(dwarf2_frame_h) \
+	$(reggroups_h) $(regset_h) $(value_h) $(gdb_assert_h) $(dis_asm_h) \
+	$(solib_svr4_h) $(s390_tdep_h)
 scm-exp.o: scm-exp.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \
 	$(parser_defs_h) $(language_h) $(value_h) $(c_lang_h) $(scm_lang_h) \
 	$(scm_tags_h)
Index: s390-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/s390-tdep.c,v
retrieving revision 1.128
diff -u -r1.128 s390-tdep.c
--- s390-tdep.c	18 Feb 2004 04:17:35 -0000	1.128
+++ s390-tdep.c	26 Feb 2004 23:34:23 -0000
@@ -38,6 +38,7 @@
 #include "trad-frame.h"
 #include "frame-base.h"
 #include "frame-unwind.h"
+#include "dwarf2-frame.h"
 #include "reggroups.h"
 #include "regset.h"
 #include "value.h"
@@ -2298,6 +2299,53 @@
 }
 
 
+/* DWARF-2 frame support.  */
+
+static void
+s390_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum,
+                            struct dwarf2_frame_state_reg *reg)
+{
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+  switch (tdep->abi)
+    {
+    case ABI_LINUX_S390:
+      /* Call-saved registers.  */
+      if ((regnum >= S390_R6_REGNUM && regnum <= S390_R15_REGNUM)
+	  || regnum == S390_F4_REGNUM
+	  || regnum == S390_F6_REGNUM)
+	reg->how = DWARF2_FRAME_REG_SAME_VALUE;
+
+      /* Call-clobbered registers.  */
+      else if ((regnum >= S390_R0_REGNUM && regnum <= S390_R5_REGNUM)
+	       || (regnum >= S390_F0_REGNUM && regnum <= S390_F15_REGNUM
+		   && regnum != S390_F4_REGNUM && regnum != S390_F6_REGNUM))
+	reg->how = DWARF2_FRAME_REG_UNDEFINED;
+
+      /* The return address column.  */
+      else if (regnum == S390_PC_REGNUM)
+	reg->how = DWARF2_FRAME_REG_RA;
+      break;
+
+    case ABI_LINUX_ZSERIES:
+      /* Call-saved registers.  */
+      if ((regnum >= S390_R6_REGNUM && regnum <= S390_R15_REGNUM)
+	  || (regnum >= S390_F8_REGNUM && regnum <= S390_F15_REGNUM))
+	reg->how = DWARF2_FRAME_REG_SAME_VALUE;
+
+      /* Call-clobbered registers.  */
+      else if ((regnum >= S390_R0_REGNUM && regnum <= S390_R5_REGNUM)
+	       || (regnum >= S390_F0_REGNUM && regnum <= S390_F7_REGNUM))
+	reg->how = DWARF2_FRAME_REG_UNDEFINED;
+
+      /* The return address column.  */
+      else if (regnum == S390_PC_REGNUM)
+	reg->how = DWARF2_FRAME_REG_RA;
+      break;
+    }
+}
+
+
 /* Dummy function calls.  */
 
 /* Return non-zero if TYPE is an integer-like type, zero otherwise.
@@ -2977,6 +3025,9 @@
 
   /* Frame handling.  */
   set_gdbarch_in_solib_call_trampoline (gdbarch, in_plt_section);
+  dwarf2_frame_set_init_reg (gdbarch, s390_dwarf2_frame_init_reg);
+  frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
+  frame_base_append_sniffer (gdbarch, dwarf2_frame_base_sniffer);
   frame_unwind_append_sniffer (gdbarch, s390_pltstub_frame_sniffer);
   frame_unwind_append_sniffer (gdbarch, s390_sigtramp_frame_sniffer);
   frame_unwind_append_sniffer (gdbarch, s390_frame_sniffer);

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

* Re: [PATCH] Enable DWARF-2 frames on S/390
  2004-02-26 23:48     ` Andrew Cagney
@ 2004-02-27  1:46       ` Ulrich Weigand
  0 siblings, 0 replies; 5+ messages in thread
From: Ulrich Weigand @ 2004-02-27  1:46 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: Ulrich Weigand, gdb-patches

Andrew Cagney wrote:

> 2004-02-26  Andrew Cagney  <cagney@redhat.com>
> 
> 	* Makefile.in: Update dependencies.
> 	Changes from Ulrich Weigand,
> 	* s390-tdep.c: Include "dwarf2-frame.h".
> 	(s390_dwarf2_frame_init_reg): New function.
> 	(s390_gdbarch_init): Install dwarf2_frame_sniffer and
> 	dwarf2_frame_base_sniffer.  Call dwarf2_frame_set_init_reg.

Thanks!  I've retested current CVS head, and it works out of the
box on s390-ibm-linux and s390x-ibm-linux using DWARF-2 CFI.

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  weigand@informatik.uni-erlangen.de


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

end of thread, other threads:[~2004-02-27  1:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-18 16:45 [PATCH] Enable DWARF-2 frames on S/390 Ulrich Weigand
2004-02-26 20:58 ` Andrew Cagney
2004-02-26 23:03   ` Ulrich Weigand
2004-02-26 23:48     ` Andrew Cagney
2004-02-27  1:46       ` Ulrich Weigand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox