From 8530209598630c25438f6c2cd323482b1a1ec886 Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Mon, 3 Nov 2003 14:44:08 +0000 Subject: [PATCH] 2003-11-03 Andrew Cagney * section.c (bfd_set_section_contents): Make the "location" buffer constant. * bfd-in2.h: Re-generate. Index: gdb/ChangeLog 2003-11-03 Andrew Cagney * exec.c (xfer_memory): Eliminate xfer_fn. --- bfd/ChangeLog | 6 ++++++ bfd/bfd-in2.h | 4 ++-- bfd/section.c | 6 +++--- gdb/ChangeLog | 4 ++++ gdb/exec.c | 22 ++++++++++++++++------ 5 files changed, 31 insertions(+), 11 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 9307eb9e19..23a604922a 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2003-11-03 Andrew Cagney + + * section.c (bfd_set_section_contents): Make the "location" buffer + constant. + * bfd-in2.h: Re-generate. + 2003-10-30 Andrew Cagney * syms.c: Replace "struct symbol_cache_entry" with "struct diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 27dbca94b4..1d0111663f 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -1483,8 +1483,8 @@ bfd_boolean bfd_set_section_size (bfd *abfd, asection *sec, bfd_size_type val); bfd_boolean bfd_set_section_contents - (bfd *abfd, asection *section, void *data, file_ptr offset, - bfd_size_type count); + (bfd *abfd, asection *section, const void *data, + file_ptr offset, bfd_size_type count); bfd_boolean bfd_get_section_contents (bfd *abfd, asection *section, void *location, file_ptr offset, diff --git a/bfd/section.c b/bfd/section.c index 360d117767..e99062aac3 100644 --- a/bfd/section.c +++ b/bfd/section.c @@ -1132,8 +1132,8 @@ FUNCTION SYNOPSIS bfd_boolean bfd_set_section_contents - (bfd *abfd, asection *section, void *data, file_ptr offset, - bfd_size_type count); + (bfd *abfd, asection *section, const void *data, + file_ptr offset, bfd_size_type count); DESCRIPTION Sets the contents of the section @var{section} in BFD @@ -1161,7 +1161,7 @@ DESCRIPTION bfd_boolean bfd_set_section_contents (bfd *abfd, sec_ptr section, - void *location, + const void *location, file_ptr offset, bfd_size_type count) { diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a580602bc3..9b2eb40c92 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2003-11-03 Andrew Cagney + + * exec.c (xfer_memory): Eliminate xfer_fn. + 2003-10-31 Kevin Buettner * frv-tdep.c (gdb_assert.h, sim-regno.h, gdb/sim-frv.h) diff --git a/gdb/exec.c b/gdb/exec.c index 8ca669ea67..a8ae0c03ac 100644 --- a/gdb/exec.c +++ b/gdb/exec.c @@ -457,7 +457,6 @@ xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write, int res; struct section_table *p; CORE_ADDR nextsectaddr, memend; - int (*xfer_fn) (bfd *, sec_ptr, void *, file_ptr, bfd_size_type); asection *section = NULL; if (len <= 0) @@ -471,7 +470,6 @@ xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write, } memend = memaddr + len; - xfer_fn = write ? bfd_set_section_contents : bfd_get_section_contents; nextsectaddr = memend; for (p = target->to_sections; p < target->to_sections_end; p++) @@ -484,8 +482,14 @@ xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write, if (memend <= p->endaddr) { /* Entire transfer is within this section. */ - res = xfer_fn (p->bfd, p->the_bfd_section, myaddr, - memaddr - p->addr, len); + if (write) + res = bfd_set_section_contents (p->bfd, p->the_bfd_section, + myaddr, memaddr - p->addr, + len); + else + res = bfd_get_section_contents (p->bfd, p->the_bfd_section, + myaddr, memaddr - p->addr, + len); return (res != 0) ? len : 0; } else if (memaddr >= p->endaddr) @@ -497,8 +501,14 @@ xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write, { /* This section overlaps the transfer. Just do half. */ len = p->endaddr - memaddr; - res = xfer_fn (p->bfd, p->the_bfd_section, myaddr, - memaddr - p->addr, len); + if (write) + res = bfd_set_section_contents (p->bfd, p->the_bfd_section, + myaddr, memaddr - p->addr, + len); + else + res = bfd_get_section_contents (p->bfd, p->the_bfd_section, + myaddr, memaddr - p->addr, + len); return (res != 0) ? len : 0; } } -- 2.34.1