Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(209)

Unified Diff: gdb/symfile-mem.c

Issue 11969036: Merge GDB 7.5.1 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@master
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gdb/symfile.c ('k') | gdb/symmisc.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gdb/symfile-mem.c
diff --git a/gdb/symfile-mem.c b/gdb/symfile-mem.c
index 91125e15e5fe43333a0b8c3492f0d0ef3eccd463..e80fd250a4ed88efec87cace092930a84c17dc8a 100644
--- a/gdb/symfile-mem.c
+++ b/gdb/symfile-mem.c
@@ -55,6 +55,25 @@
#include "auxv.h"
#include "elf/common.h"
+/* Verify parameters of target_read_memory_bfd and target_read_memory are
+ compatible. */
+
+gdb_static_assert (sizeof (CORE_ADDR) == sizeof (bfd_vma));
+gdb_static_assert (sizeof (gdb_byte) == sizeof (bfd_byte));
+gdb_static_assert (sizeof (ssize_t) <= sizeof (bfd_size_type));
+
+/* Provide bfd/ compatible prototype for target_read_memory. Casting would not
+ be enough as LEN width may differ. */
+
+static int
+target_read_memory_bfd (bfd_vma memaddr, bfd_byte *myaddr, bfd_size_type len)
+{
+ /* MYADDR must be already allocated for the LEN size so it has to fit in
+ ssize_t. */
+ gdb_assert ((ssize_t) len == len);
+
+ return target_read_memory (memaddr, myaddr, len);
+}
/* Read inferior memory at ADDR to find the header of a loaded object file
and read its in-core symbols out of inferior memory. TEMPL is a bfd
@@ -77,7 +96,7 @@ symbol_file_add_from_memory (struct bfd *templ, CORE_ADDR addr, char *name,
error (_("add-symbol-file-from-memory not supported for this target"));
nbfd = bfd_elf_bfd_from_remote_memory (templ, addr, &loadbase,
- target_read_memory);
+ target_read_memory_bfd);
if (nbfd == NULL)
error (_("Failed to read a valid object file image from memory."));
« no previous file with comments | « gdb/symfile.c ('k') | gdb/symmisc.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698