Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Subject: Fix Ericsson DICOS inferior function calls
Date: Mon, 07 Jul 2008 22:10:00 -0000	[thread overview]
Message-ID: <200807072309.56077.pedro@codesourcery.com> (raw)

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

Hi,

This patch fixes inferior function calls on DICOS, by putting
the call dummy breakpoint location on the stack.  The comments
in the patch describe why.

Daniel approved this offline, so I checked it in.

Thanks,

-- 
Pedro Alves

[-- Attachment #2: dicos_call_dummy_on_stack.diff --]
[-- Type: text/x-diff, Size: 2548 bytes --]

2008-07-07  Pedro Alves  <pedro@codesourcery.com>

	* i386-dicos-tdep.c: Include "inferior.h".
	(i386_dicos_frame_align): New.
	(i386_dicos_init_abi): Register i386_dicos_frame_align.  Set call
	dummy location ON_STACK.
	* Makefile.in (i386-dicos-tdep.o): Depend on $(inferior_h).

---
 gdb/Makefile.in       |    2 +-
 gdb/i386-dicos-tdep.c |   18 ++++++++++++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)

Index: src/gdb/Makefile.in
===================================================================
--- src.orig/gdb/Makefile.in	2008-07-07 22:59:22.000000000 +0100
+++ src/gdb/Makefile.in	2008-07-07 23:00:53.000000000 +0100
@@ -2236,7 +2236,7 @@ i386-cygwin-tdep.o: i386-cygwin-tdep.c $
 	$(i386_tdep_h) $(regset_h) $(gdb_obstack_h) $(xml_support_h) \
 	$(gdbcore_h) $(solib_h) $(solib_target_h) $(i386_cygwin_tdep_h)
 i386-dicos-tdep.o: i386-dicos-tdep.c $(defs_h) $(osabi_h) $(gdb_string_h) \
-	$(solib_h) $(solib_target_h)
+	$(solib_h) $(solib_target_h) $(inferior_h)
 i386fbsd-nat.o: i386fbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \
 	$(target_h) $(fbsd_nat_h) $(i386_tdep_h) $(i386bsd_nat_h) \
 	$(bsd_kvm_h)
Index: src/gdb/i386-dicos-tdep.c
===================================================================
--- src.orig/gdb/i386-dicos-tdep.c	2008-05-15 23:35:10.000000000 +0100
+++ src/gdb/i386-dicos-tdep.c	2008-07-07 23:00:53.000000000 +0100
@@ -22,6 +22,18 @@
 #include "gdb_string.h"
 #include "solib.h"
 #include "solib-target.h"
+#include "inferior.h"
+
+static CORE_ADDR
+i386_dicos_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp)
+{
+  /* Having a call dummy on the stack requires a gdbarch_frame_align
+     method to align the breakpoint instruction in the stack.
+     Strictly speaking, we could just return SP pristine on x86.  But,
+     as long as we're providing a frame align method, might as well
+     align for efficiency.  */
+  return sp & -(CORE_ADDR)16;
+}
 
 static void
 i386_dicos_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
@@ -29,6 +41,12 @@ i386_dicos_init_abi (struct gdbarch_info
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
   set_solib_ops (gdbarch, &solib_target_so_ops);
+
+  /* There's no (standard definition of) entry point or a guaranteed
+     text location we could find with a symbol where to place the call
+     dummy, so we put it on the stack.  */
+  set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
+  set_gdbarch_frame_align (gdbarch, i386_dicos_frame_align);
 }
 
 /* Look in the elf symbol table of ABFD for a symbol named WANTED.

             reply	other threads:[~2008-07-07 22:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-07 22:10 Pedro Alves [this message]
2008-07-07 22:59 ` Mark Kettenis
2008-07-07 23:36   ` Pedro Alves
2008-07-09 15:48   ` Pedro Alves
2008-07-14 15:10     ` Mark Kettenis
2008-07-14 18:09       ` Pedro Alves

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=200807072309.56077.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    /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