diff mbox

[RFC,4/5] Declare Infinity proc_service functions in gdb_proc_service.h

Message ID 1496913338-22195-5-git-send-email-gbenson@redhat.com
State New
Headers show

Commit Message

Gary Benson June 8, 2017, 9:15 a.m. UTC
This commit adds declarations for the two new proc_service functions
required by Infinity libthread_db.so.

gdb/ChangeLog:

	* gdb_proc_service.h (ps_infinity_reloc_f): New typedef.
	(ps_visit_infinity_note_f): Likewise.
	(ps_get_register): New declaration.
	(ps_foreach_infinity_note): Likewise.
---
 gdb/ChangeLog          |  7 +++++++
 gdb/gdb_proc_service.h | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 53 insertions(+)
diff mbox

Patch

diff --git a/gdb/gdb_proc_service.h b/gdb/gdb_proc_service.h
index 734fcb2..59b8d6e 100644
--- a/gdb/gdb_proc_service.h
+++ b/gdb/gdb_proc_service.h
@@ -175,6 +175,52 @@  typedef gdb_fpregset_t gdb_prfpregset_t;
 typedef prfpregset_t gdb_prfpregset_t;
 #endif
 
+/* XXX need to check for ps_get_register and ps_foreach_infinity_note
+   in ./configure if HAVE_PROC_SERVICE_H and only define them here if
+   we don't already have them.  */
+
+EXTERN_C_PUSH
+
+/* Get the contents of a single register.  */
+extern ps_err_e ps_get_register (struct ps_prochandle *ph,
+				 lwpid_t lwpid, int dwarf_regnum,
+				 psaddr_t *result);
+
+/* Callback to relocate addresses in Infinity notes.  */
+typedef ps_err_e ps_infinity_reloc_f (void *rf_arg,
+				      psaddr_t unrelocated,
+				      psaddr_t *result);
+
+/* Callback for iteration over Infinity notes.  Should return PS_OK to
+   indicate success, or any other value to indicate failure.  CB_ARG
+   is whatever was passed as CB_ARG to ps_foreach_infinity_note.  BUF
+   is is a pointer to a buffer of BUFSIZ bytes containing the encoded
+   note.  SRCNAME is an identifier used to construct error messages,
+   typically a filename, and may be NULL if unset.  SRCOFFSET is the
+   offset into SRCNAME of the start of BUF, and may be -1 if unset.
+   RF is a function that should be used to relocate addresses in this
+   notes, and RF_ARG is an argument that should be passed as to RF.  */
+typedef ps_err_e ps_visit_infinity_note_f (void *cb_arg,
+					   const char *buf,
+					   size_t bufsiz,
+					   const char *srcname,
+					   ssize_t srcoffset,
+					   ps_infinity_reloc_f *rf,
+					   void *rf_arg);
+
+/* Call the callback CB for each Infinity note in the process.  The
+   callback should return PS_OK to indicate that iteration should
+   continue, or any other value to indicate that iteration should stop
+   and that ps_foreach_infinity_note should return the non-PS_OK value
+   that the callback returned.  Return PS_OK if the callback returned
+   PS_OK for all Infinity notes, or if there are no Infinity notes in
+   the process.  */
+extern ps_err_e ps_foreach_infinity_note (struct ps_prochandle *ph,
+					  ps_visit_infinity_note_f *cb,
+					  void *cb_arg);
+
+EXTERN_C_POP
+
 /* GDB specific structure that identifies the target process.  */
 struct ps_prochandle
 {