Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <yao@codesourcery.com>
To: <gdb-patches@sourceware.org>
Subject: [PATCH 2/6] core_xfer_shared_libraries and core_xfer_shared_libraries_aix returns ULONGEST
Date: Fri, 31 Jan 2014 03:37:00 -0000	[thread overview]
Message-ID: <1391139325-2758-3-git-send-email-yao@codesourcery.com> (raw)
In-Reply-To: <1391139325-2758-1-git-send-email-yao@codesourcery.com>

This patch specifies the return value of core_xfer_shared_libraries_aix
and core_xfer_shared_libraries, and change return value to ULONGEST.

The following patch can check its return value in core_xfer_partial
and return appropriate target_xfer_status in core_xfer_partial.

gdb:

2014-01-30  Yao Qi  <yao@codesourcery.com>

	* gdbarch.sh (core_xfer_shared_libraries): Returns ULONGEST.  Add
	comments.
	(core_xfer_shared_libraries_aix): Likewise.
	* gdbarch.c, gdbarch.h: Regenerated.
	* i386-cygwin-tdep.c (windows_core_xfer_shared_libraries): Return
	ULONGEST.  Change 'len_avail' type to ULONGEST.
	* rs6000-aix-tdep.c (rs6000_aix_ld_info_to_xml): Likewise.
	* rs6000-aix-tdep.h (rs6000_aix_ld_info_to_xml): Update
	declaration.
	(rs6000_aix_core_xfer_shared_libraries_aix): Return ULONGEST.
---
 gdb/gdbarch.c          |    4 ++--
 gdb/gdbarch.h          |   15 +++++++++------
 gdb/gdbarch.sh         |    9 ++++++---
 gdb/i386-cygwin-tdep.c |    4 ++--
 gdb/rs6000-aix-tdep.c  |    6 +++---
 gdb/rs6000-aix-tdep.h  |   12 ++++++------
 6 files changed, 28 insertions(+), 22 deletions(-)

diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index ee41d50..404c01c 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -3499,7 +3499,7 @@ gdbarch_core_xfer_shared_libraries_p (struct gdbarch *gdbarch)
   return gdbarch->core_xfer_shared_libraries != NULL;
 }
 
-LONGEST
+ULONGEST
 gdbarch_core_xfer_shared_libraries (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, ULONGEST len)
 {
   gdb_assert (gdbarch != NULL);
@@ -3523,7 +3523,7 @@ gdbarch_core_xfer_shared_libraries_aix_p (struct gdbarch *gdbarch)
   return gdbarch->core_xfer_shared_libraries_aix != NULL;
 }
 
-LONGEST
+ULONGEST
 gdbarch_core_xfer_shared_libraries_aix (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, ULONGEST len)
 {
   gdb_assert (gdbarch != NULL);
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index b28a80e..8fd0b88 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -761,21 +761,24 @@ extern int gdbarch_find_memory_regions (struct gdbarch *gdbarch, find_memory_reg
 extern void set_gdbarch_find_memory_regions (struct gdbarch *gdbarch, gdbarch_find_memory_regions_ftype *find_memory_regions);
 
 /* Read offset OFFSET of TARGET_OBJECT_LIBRARIES formatted shared libraries list from
-   core file into buffer READBUF with length LEN. */
+   core file into buffer READBUF with length LEN.  Return the number of bytes read (
+   zero indicates failure).
+   failed, otherwise, return the red length of READBUF. */
 
 extern int gdbarch_core_xfer_shared_libraries_p (struct gdbarch *gdbarch);
 
-typedef LONGEST (gdbarch_core_xfer_shared_libraries_ftype) (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, ULONGEST len);
-extern LONGEST gdbarch_core_xfer_shared_libraries (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, ULONGEST len);
+typedef ULONGEST (gdbarch_core_xfer_shared_libraries_ftype) (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, ULONGEST len);
+extern ULONGEST gdbarch_core_xfer_shared_libraries (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, ULONGEST len);
 extern void set_gdbarch_core_xfer_shared_libraries (struct gdbarch *gdbarch, gdbarch_core_xfer_shared_libraries_ftype *core_xfer_shared_libraries);
 
 /* Read offset OFFSET of TARGET_OBJECT_LIBRARIES_AIX formatted shared
-   libraries list from core file into buffer READBUF with length LEN. */
+   libraries list from core file into buffer READBUF with length LEN.
+   Return the number of bytes read (zero indicates failure). */
 
 extern int gdbarch_core_xfer_shared_libraries_aix_p (struct gdbarch *gdbarch);
 
-typedef LONGEST (gdbarch_core_xfer_shared_libraries_aix_ftype) (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, ULONGEST len);
-extern LONGEST gdbarch_core_xfer_shared_libraries_aix (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, ULONGEST len);
+typedef ULONGEST (gdbarch_core_xfer_shared_libraries_aix_ftype) (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, ULONGEST len);
+extern ULONGEST gdbarch_core_xfer_shared_libraries_aix (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, ULONGEST len);
 extern void set_gdbarch_core_xfer_shared_libraries_aix (struct gdbarch *gdbarch, gdbarch_core_xfer_shared_libraries_aix_ftype *core_xfer_shared_libraries_aix);
 
 /* How the core target converts a PTID from a core file to a string. */
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 36dff57..e3e9bbd 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -659,12 +659,15 @@ F:char *:elfcore_write_linux_prpsinfo:bfd *obfd, char *note_data, int *note_size
 M:int:find_memory_regions:find_memory_region_ftype func, void *data:func, data
 
 # Read offset OFFSET of TARGET_OBJECT_LIBRARIES formatted shared libraries list from
-# core file into buffer READBUF with length LEN.
-M:LONGEST:core_xfer_shared_libraries:gdb_byte *readbuf, ULONGEST offset, ULONGEST len:readbuf, offset, len
+# core file into buffer READBUF with length LEN.  Return the number of bytes read (
+# zero indicates failure).
+# failed, otherwise, return the red length of READBUF.
+M:ULONGEST:core_xfer_shared_libraries:gdb_byte *readbuf, ULONGEST offset, ULONGEST len:readbuf, offset, len
 
 # Read offset OFFSET of TARGET_OBJECT_LIBRARIES_AIX formatted shared
 # libraries list from core file into buffer READBUF with length LEN.
-M:LONGEST:core_xfer_shared_libraries_aix:gdb_byte *readbuf, ULONGEST offset, ULONGEST len:readbuf, offset, len
+# Return the number of bytes read (zero indicates failure).
+M:ULONGEST:core_xfer_shared_libraries_aix:gdb_byte *readbuf, ULONGEST offset, ULONGEST len:readbuf, offset, len
 
 # How the core target converts a PTID from a core file to a string.
 M:char *:core_pid_to_str:ptid_t ptid:ptid
diff --git a/gdb/i386-cygwin-tdep.c b/gdb/i386-cygwin-tdep.c
index 4b8a00d..7b7785a 100644
--- a/gdb/i386-cygwin-tdep.c
+++ b/gdb/i386-cygwin-tdep.c
@@ -168,14 +168,14 @@ out:
   return;
 }
 
-static LONGEST
+static ULONGEST
 windows_core_xfer_shared_libraries (struct gdbarch *gdbarch,
 				  gdb_byte *readbuf,
 				  ULONGEST offset, ULONGEST len)
 {
   struct obstack obstack;
   const char *buf;
-  LONGEST len_avail;
+  ULONGEST len_avail;
   struct cpms_data data = { gdbarch, &obstack, 0 };
 
   obstack_init (&obstack);
diff --git a/gdb/rs6000-aix-tdep.c b/gdb/rs6000-aix-tdep.c
index aeea3ed..3ab8883 100644
--- a/gdb/rs6000-aix-tdep.c
+++ b/gdb/rs6000-aix-tdep.c
@@ -965,14 +965,14 @@ rs6000_aix_shared_library_to_xml (struct ld_info *ldi,
    as the consumer of the XML library list might live in a different
    process.  */
 
-LONGEST
+ULONGEST
 rs6000_aix_ld_info_to_xml (struct gdbarch *gdbarch, const gdb_byte *ldi_buf,
 			   gdb_byte *readbuf, ULONGEST offset, ULONGEST len,
 			   int close_ldinfo_fd)
 {
   struct obstack obstack;
   const char *buf;
-  LONGEST len_avail;
+  ULONGEST len_avail;
 
   obstack_init (&obstack);
   obstack_grow_str (&obstack, "<library-list-aix version=\"1.0\">\n");
@@ -1009,7 +1009,7 @@ rs6000_aix_ld_info_to_xml (struct gdbarch *gdbarch, const gdb_byte *ldi_buf,
 
 /* Implement the core_xfer_shared_libraries_aix gdbarch method.  */
 
-static LONGEST
+static ULONGEST
 rs6000_aix_core_xfer_shared_libraries_aix (struct gdbarch *gdbarch,
 					   gdb_byte *readbuf,
 					   ULONGEST offset,
diff --git a/gdb/rs6000-aix-tdep.h b/gdb/rs6000-aix-tdep.h
index 76765f1..90fc5ed 100644
--- a/gdb/rs6000-aix-tdep.h
+++ b/gdb/rs6000-aix-tdep.h
@@ -18,11 +18,11 @@
 #ifndef RS6000_AIX_TDEP_H
 #define RS6000_AIX_TDEP_H
 
-extern LONGEST rs6000_aix_ld_info_to_xml (struct gdbarch *gdbarch,
-					  const gdb_byte *ldi_buf,
-					  gdb_byte *readbuf,
-					  ULONGEST offset,
-					  ULONGEST len,
-					  int close_ldinfo_fd);
+extern ULONGEST rs6000_aix_ld_info_to_xml (struct gdbarch *gdbarch,
+					   const gdb_byte *ldi_buf,
+					   gdb_byte *readbuf,
+					   ULONGEST offset,
+					   ULONGEST len,
+					   int close_ldinfo_fd);
 
 #endif /* RS6000_AIX_TDEP_H */
-- 
1.7.7.6


  reply	other threads:[~2014-01-31  3:37 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-31  3:37 [PATCH 0/6] Return target_xfer_status in to_xfer_partial Yao Qi
2014-01-31  3:37 ` Yao Qi [this message]
2014-02-06 14:43   ` [PATCH 2/6] core_xfer_shared_libraries and core_xfer_shared_libraries_aix returns ULONGEST Pedro Alves
2014-02-07  4:21     ` Yao Qi
2014-01-31  3:37 ` [PATCH 1/6] Tweak in memory_error Yao Qi
2014-02-06 12:41   ` Pedro Alves
2014-02-07  4:21     ` Yao Qi
2014-01-31  3:38 ` [PATCH 4/6] Return early in target_xfer_partial when LEN is zero Yao Qi
2014-02-06 14:44   ` Pedro Alves
2014-01-31  3:38 ` [PATCH 6/6] Update comments to to_xfer_partial implementations Yao Qi
2014-01-31  3:50   ` Joel Brobecker
2014-01-31  3:38 ` [PATCH 3/6] Replace -1 with TARGET_XFER_E_IO Yao Qi
2014-02-06 14:43   ` Pedro Alves
2014-01-31  3:39 ` [PATCH 5/6] Return target_xfer_status in to_xfer_partial Yao Qi
2014-02-06 14:44   ` Pedro Alves
2014-02-07  2:11     ` Yao Qi
2014-02-11  6:35     ` Yao Qi

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=1391139325-2758-3-git-send-email-yao@codesourcery.com \
    --to=yao@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