[PATCH] bfd: Use size_t for length argument totarget_read_memory function passed into bfd_elf_bfd_from_remote_memory

Siddhesh Poyarekar siddhesh@redhat.com
Mon May 28 09:05:00 GMT 2012


Hi,

The target_read_memory function pointer that
bfd_elf_bfd_from_remote_memory accepts current accepts int for length.
I have attached a patch which changes this argument to size_t. This
change is needed because I'm looking to make analogous changes in gdb to
ensure consistency of storage sizes passed across functions to ensure
that larger values are not truncated.

I could write a wrapper around or cast the function pointer explicitly,
but as Jan Kratochvil suggested, it would be cleaner to just make a
change in bfd since it should be taking size_t values anyway. The
conversation thread is here for reference:

http://sourceware.org/ml/gdb-patches/2012-05/msg00909.html

Attached are two patches, the first being changes to bfd and the second
is the change I need to make in gdb to make it work with the changes in
bfd.

Regards,
Siddhesh

bfd/ChangeLog:

2012-05-28  Siddhesh Poyarekar  <siddhesh@redhat.com>

	* bfd-in.h (bfd_elf_bfd_from_remote_memory): Make LEN argument
	of target_read_memory as size_t.
	* bfd-in2.h: Regenerate.
	* elf-bfd.h (elf_backend_bfd_from_remote_memory): Make LEN
	  argument of target_read_memory as size_t.
	(_bfd_elf32_bfd_from_remote_memory): Likewise.
	(_bfd_elf64_bfd_from_remote_memory): Likewise.
	* elf.c (bfd_elf_bfd_from_remote_memory): Likewise.
	* enfcode.h (NAME): Likewise.

gdb/ChangeLog:

2012-05-28  Siddhesh Poyarekar  <siddhesh@redhat.com>

	* target.c (target_read_memory): Make LEN argument as size_t.
	* target.h (target_read_memory): Likewise.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-bfd-changes-for-target_read_memory.patch
Type: text/x-patch
Size: 3176 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20120528/b28410e5/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-gdb-changes-for-target_read_memory.patch
Type: text/x-patch
Size: 1043 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20120528/b28410e5/attachment-0001.bin>


More information about the Binutils mailing list