Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Ulrich Weigand <weigand@i1.informatik.uni-erlangen.de>
To: kettenis@chello.nl (Mark Kettenis)
Cc: gdb-patches@sources.redhat.com, weigand@informatik.uni-erlangen.de
Subject: Re: [PATCH/RFC] Per-architecture DWARF CFI register state initialization hooks
Date: Sun, 08 Feb 2004 01:01:00 -0000	[thread overview]
Message-ID: <200402080101.CAA13594@faui1d.informatik.uni-erlangen.de> (raw)
In-Reply-To: <200402072237.i17Mbqae011375@elgar.kettenis.dyndns.org> from "Mark Kettenis" at Feb 07, 2004 11:37:52 PM

Mark Kettenis wrote:

> Ulrich, this should privide the hooks you need.  For S/390 you should
> provide a function with the following signature:
> 
> void
> s390_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum,
>                             struct gdbarch dwarf2_frame_state_reg *reg);
> 
> and initialize REG according to your needs for the REGNUMs you care
> about.  Note that REGNUM is the GDB register number.

This works for S/390; thanks for taking care of this problem!

With your patch and the one appended below, the test suite passes
without regressions; even after additionally switching off the
traditional frame handling in s390-tdep, the test suite still
passes with regressions only in asm-source (because the assembler
code lacks CFI instrumentation).

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	Sat Feb  7 23:57:09 2004
--- gdb-head-new/gdb/Makefile.in	Sat Feb  7 23:59:04 2004
*************** s390-nat.o: s390-nat.c $(defs_h) $(tm_h)
*** 2276,2282 ****
  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) \
  	$(s390_tdep_h)
  scm-exp.o: scm-exp.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \
--- 2276,2282 ----
  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) \
  	$(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	Sat Feb  7 23:57:09 2004
--- gdb-head-new/gdb/s390-tdep.c	Sun Feb  8 00:08:20 2004
***************
*** 39,44 ****
--- 39,45 ----
  #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 == 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 == 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
*** 2910,2915 ****
--- 2958,2966 ----
  
    /* 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


  parent reply	other threads:[~2004-02-08  1:01 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-07 22:38 Mark Kettenis
2004-02-07 23:03 ` Daniel Jacobowitz
2004-02-07 23:48 ` Andrew Cagney
2004-02-15 15:31   ` Mark Kettenis
2004-02-15 16:04     ` Andrew Cagney
2004-02-15 18:09       ` Daniel Jacobowitz
2004-02-15 19:49         ` Andrew Cagney
2004-02-15 20:37           ` Daniel Jacobowitz
2004-02-15 21:37             ` Andrew Cagney
2004-02-15 22:54               ` Daniel Jacobowitz
2004-02-15 21:31       ` Mark Kettenis
2004-02-08  1:01 ` Ulrich Weigand [this message]
2004-02-16  1:28 Ulrich Weigand
2004-02-16  1:56 ` Daniel Jacobowitz
2004-02-16 13:01   ` Ulrich Weigand
2004-02-16 19:47     ` Daniel Jacobowitz
2004-02-16 20:50       ` Andrew Cagney
2004-02-16 20:55         ` Andrew Cagney
2004-02-18 16:59           ` Mark Kettenis
2004-02-18 18:40             ` Andrew Cagney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200402080101.CAA13594@faui1d.informatik.uni-erlangen.de \
    --to=weigand@i1.informatik.uni-erlangen.de \
    --cc=gdb-patches@sources.redhat.com \
    --cc=kettenis@chello.nl \
    --cc=weigand@informatik.uni-erlangen.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox