This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC] TARGET_OBJECT_WCOOKIE


Actually the purpose of this RFC is twofold.

First, I'd like to add a TARGET_OBJECT_WCOOKIE method to support the
StackGhost cookie on OpenBSD/sparc.  This really is something
target-related rather than OS/ABI related.  GDB will have to deal with
StackGhost when running non-OpenBSD binaries on an OpenBSD kernel.
Moreover, older OpenBSD kernels might not have StackGhost.  Anyway,
are there objections to adding something like the attached patch?

The second issue I'd like your opinion on is related to the patch.  I
followed the example set by TARGET_OBJECT_UNWIND_TABLE in having a
macro (NATIVE_XFER_WCOOKIE) to invoke the native-specific function
that fetches the cookie.  This macro would be defined in the nm.h
file, but wasn't it our goal to get rid of the nm.h file sooner rather
than later?  Shouldn't we add another method for these kinds of hooks?
The obvious alternatives are:

a) Use a public function pointer, which is initialized to some
   do-nothing-and-return-minus-one function by default.  This function
   pointer would be overridden by some code in the appropraite *-nat.c
   files.

b) Use a private function pointer, and provide a function to set that
   pointer, along the lines of inftarg_set_find_memory_regions().

Opinions?

Mark


Index: inftarg.c
===================================================================
RCS file: /cvs/src/src/gdb/inftarg.c,v
retrieving revision 1.21
diff -u -p -r1.21 inftarg.c
--- inftarg.c 14 Nov 2003 20:49:23 -0000 1.21
+++ inftarg.c 1 Feb 2004 15:55:47 -0000
@@ -1,7 +1,7 @@
 /* Target-vector operations for controlling Unix child processes, for GDB.
 
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999,
-   2000, 2002, 2003 Free Software Foundation, Inc.
+   2000, 2002, 2003, 2004 Free Software Foundation, Inc.
 
    Contributed by Cygnus Support.
 
@@ -577,6 +577,12 @@ child_xfer_partial (struct target_ops *o
 #endif
       return NATIVE_XFER_UNWIND_TABLE (ops, object, annex, readbuf, writebuf,
 				       offset, len);
+
+#ifdef NATIVE_XFER_WCOOKIE
+    case TARGET_OBJECT_WCOOKIE:
+      return NATIVE_XFER_WCOOKIE (ops, object, annex, readbuf, writebuf,
+				  offset, len);
+#endif
 
 #if 0
     case TARGET_OBJECT_AUXV:
Index: target.h
===================================================================
RCS file: /cvs/src/src/gdb/target.h,v
retrieving revision 1.55
diff -u -p -r1.55 target.h
--- target.h 17 Jan 2004 21:56:12 -0000 1.55
+++ target.h 1 Feb 2004 15:55:47 -0000
@@ -226,6 +226,8 @@ enum target_object
   TARGET_OBJECT_MEMORY,
   /* Kernel Unwind Table.  See "ia64-tdep.c".  */
   TARGET_OBJECT_UNWIND_TABLE,
+  /* StackGhost cookie.  See "sparc-tdep.c".  */
+  TARGET_OBJECT_WCOOKIE,
   /* Possible future objects: TARGET_OBJECT_FILE, TARGET_OBJECT_PROC,
      TARGET_OBJECT_AUXV, ...  */
 };


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]