From d4b2399a9c2702d7b6ed31df1187fd7eef4e0ffb Mon Sep 17 00:00:00 2001 From: "J.T. Conklin" Date: Sat, 20 May 2000 10:29:51 +0000 Subject: [PATCH] * target.h (target_memory_bfd_section): Removed declaration. * target.c (target_memory_bfd_section): Removed. * exec.c (xfer_memory): Removed #if'ed-out code which referenced target_memory_bfd_section. * target.h (target_read_memory_section): Removed declaration. * target.c (target_read_memory_section): Removed. (target_xfer_memory): Update, removed bfd_section argument. (target_read_string, target_read_memory, target_write_memory): Update for above change. * gdbcore.h (read_memory_section): Removed declaration. * corefile.c (read_memory_section): Removed. * jv-lang.c (get_java_utf8_name): Changed calls to read_memory_section to read_memory. * printcmd.c (printf_command): Likewise. * valops.c (value_at, value_fetch_lazy): Likewise. --- gdb/ChangeLog | 20 ++++++++++++++++++++ gdb/corefile.c | 14 -------------- gdb/exec.c | 43 ------------------------------------------- gdb/gdbcore.h | 3 --- gdb/jv-lang.c | 2 +- gdb/printcmd.c | 5 ++--- gdb/target.c | 31 ++++++------------------------- gdb/target.h | 5 ----- gdb/valops.c | 6 +++--- 9 files changed, 32 insertions(+), 97 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index efc6037db12..643164dc383 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,23 @@ +2000-05-20 J.T. Conklin + + * target.h (target_memory_bfd_section): Removed declaration. + * target.c (target_memory_bfd_section): Removed. + * exec.c (xfer_memory): Removed #if'ed-out code which referenced + target_memory_bfd_section. + + * target.h (target_read_memory_section): Removed declaration. + * target.c (target_read_memory_section): Removed. + (target_xfer_memory): Update, removed bfd_section argument. + (target_read_string, target_read_memory, target_write_memory): + Update for above change. + + * gdbcore.h (read_memory_section): Removed declaration. + * corefile.c (read_memory_section): Removed. + * jv-lang.c (get_java_utf8_name): Changed calls to + read_memory_section to read_memory. + * printcmd.c (printf_command): Likewise. + * valops.c (value_at, value_fetch_lazy): Likewise. + 2000-05-18 J.T. Conklin * configure.host, configure.tgt (powerpc-*-netbsd*): New entry. diff --git a/gdb/corefile.c b/gdb/corefile.c index 4d11cbdcdf7..ccf439eacc1 100644 --- a/gdb/corefile.c +++ b/gdb/corefile.c @@ -270,21 +270,7 @@ read_memory (memaddr, myaddr, len) memory_error (status, memaddr); } -void -read_memory_section (memaddr, myaddr, len, bfd_section) - CORE_ADDR memaddr; - char *myaddr; - int len; - asection *bfd_section; -{ - int status; - status = target_read_memory_section (memaddr, myaddr, len, bfd_section); - if (status != 0) - memory_error (status, memaddr); -} - /* Like target_read_memory, but slightly different parameters. */ - int dis_asm_read_memory (memaddr, myaddr, len, info) bfd_vma memaddr; diff --git a/gdb/exec.c b/gdb/exec.c index 6381e63e358..57d39e958ab 100644 --- a/gdb/exec.c +++ b/gdb/exec.c @@ -490,49 +490,6 @@ xfer_memory (memaddr, myaddr, len, write, target) xfer_fn = write ? bfd_set_section_contents : bfd_get_section_contents; nextsectaddr = memend; -#if 0 /* Stu's implementation */ -/* If a section has been specified, try to use it. Note that we cannot use the - specified section directly. This is because it usually comes from the - symbol file, which may be different from the exec or core file. Instead, we - have to lookup the specified section by name in the bfd associated with - to_sections. */ - - if (target_memory_bfd_section) - { - asection *s; - bfd *abfd; - asection *target_section; - bfd *target_bfd; - - s = target_memory_bfd_section; - abfd = s->owner; - - target_bfd = target->to_sections->bfd; - target_section = bfd_get_section_by_name (target_bfd, bfd_section_name (abfd, s)); - - if (target_section) - { - bfd_vma sec_addr; - bfd_size_type sec_size; - - sec_addr = bfd_section_vma (target_bfd, target_section); - sec_size = target_section->_raw_size; - - /* Make sure the requested memory starts inside the section. */ - - if (memaddr >= sec_addr - && memaddr < sec_addr + sec_size) - { - /* Cut back length in case request overflows the end of the section. */ - len = min (len, sec_addr + sec_size - memaddr); - - res = xfer_fn (target_bfd, target_section, myaddr, memaddr - sec_addr, len); - - return res ? len : 0; - } - } - } -#endif /* 0, Stu's implementation */ for (p = target->to_sections; p < target->to_sections_end; p++) { if (overlay_debugging && section && p->the_bfd_section && diff --git a/gdb/gdbcore.h b/gdb/gdbcore.h index e8e395384f9..926050d68db 100644 --- a/gdb/gdbcore.h +++ b/gdb/gdbcore.h @@ -51,9 +51,6 @@ extern void memory_error PARAMS ((int status, CORE_ADDR memaddr)); extern void read_memory PARAMS ((CORE_ADDR memaddr, char *myaddr, int len)); -extern void read_memory_section PARAMS ((CORE_ADDR memaddr, char *myaddr, - int len, asection * bfd_section)); - /* Read an integer from debugged memory, given address and number of bytes. */ diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c index 367add2427f..0f2b8ceb807 100644 --- a/gdb/jv-lang.c +++ b/gdb/jv-lang.c @@ -224,7 +224,7 @@ get_java_utf8_name (obstack, name) + TYPE_LENGTH (VALUE_TYPE (temp)); chrs = obstack_alloc (obstack, name_length + 1); chrs[name_length] = '\0'; - read_memory_section (data_addr, chrs, name_length, NULL); + read_memory (data_addr, chrs, name_length); return chrs; } diff --git a/gdb/printcmd.c b/gdb/printcmd.c index d9c3b2469e7..7ad2dd0e648 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -2319,15 +2319,14 @@ printf_command (arg, from_tty) { char c; QUIT; - read_memory_section (tem + j, &c, 1, - VALUE_BFD_SECTION (val_args[i])); + read_memory (tem + j, &c, 1); if (c == 0) break; } /* Copy the string contents into a string inside GDB. */ str = (char *) alloca (j + 1); - read_memory_section (tem, str, j, VALUE_BFD_SECTION (val_args[i])); + read_memory (tem, str, j); str[j] = 0; printf_filtered (current_substring, str); diff --git a/gdb/target.c b/gdb/target.c index 02ccc25da31..606be318d54 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -95,7 +95,7 @@ static void normal_target_post_startup_inferior PARAMS ((int pid)); static int target_xfer_memory PARAMS ((CORE_ADDR memaddr, char *myaddr, int len, - int write, asection * bfd_section)); + int write)); static void init_dummy_target PARAMS ((void)); @@ -836,7 +836,7 @@ target_read_string (memaddr, string, len, errnop) tlen = MIN (len, 4 - (memaddr & 3)); offset = memaddr & 3; - errcode = target_xfer_memory (memaddr & ~3, buf, 4, 0, NULL); + errcode = target_xfer_memory (memaddr & ~3, buf, 4, 0); if (errcode != 0) { /* The transfer request might have crossed the boundary to an @@ -844,7 +844,7 @@ target_read_string (memaddr, string, len, errnop) a single byte. */ tlen = 1; offset = 0; - errcode = target_xfer_memory (memaddr, buf, 1, 0, NULL); + errcode = target_xfer_memory (memaddr, buf, 1, 0); if (errcode != 0) goto done; } @@ -896,17 +896,7 @@ target_read_memory (memaddr, myaddr, len) char *myaddr; int len; { - return target_xfer_memory (memaddr, myaddr, len, 0, NULL); -} - -int -target_read_memory_section (memaddr, myaddr, len, bfd_section) - CORE_ADDR memaddr; - char *myaddr; - int len; - asection *bfd_section; -{ - return target_xfer_memory (memaddr, myaddr, len, 0, bfd_section); + return target_xfer_memory (memaddr, myaddr, len, 0); } int @@ -915,15 +905,9 @@ target_write_memory (memaddr, myaddr, len) char *myaddr; int len; { - return target_xfer_memory (memaddr, myaddr, len, 1, NULL); + return target_xfer_memory (memaddr, myaddr, len, 1); } -/* This variable is used to pass section information down to targets. This - *should* be done by adding an argument to the target_xfer_memory function - of all the targets, but I didn't feel like changing 50+ files. */ - -asection *target_memory_bfd_section = NULL; - /* Move memory to or from the targets. Iterate until all of it has been moved, if necessary. The top target gets priority; anything it doesn't want, is offered to the next one down, etc. Note the @@ -935,12 +919,11 @@ asection *target_memory_bfd_section = NULL; Result is 0 or errno value. */ static int -target_xfer_memory (memaddr, myaddr, len, write, bfd_section) +target_xfer_memory (memaddr, myaddr, len, write) CORE_ADDR memaddr; char *myaddr; int len; int write; - asection *bfd_section; { int curlen; int res; @@ -951,8 +934,6 @@ target_xfer_memory (memaddr, myaddr, len, write, bfd_section) if (len == 0) return 0; - target_memory_bfd_section = bfd_section; - /* to_xfer_memory is not guaranteed to set errno, even when it returns 0. */ errno = 0; diff --git a/gdb/target.h b/gdb/target.h index ea819c0d9a8..ba944b10852 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -614,10 +614,6 @@ target_read_string PARAMS ((CORE_ADDR, char **, int, int *)); extern int target_read_memory PARAMS ((CORE_ADDR memaddr, char *myaddr, int len)); -extern int -target_read_memory_section PARAMS ((CORE_ADDR memaddr, char *myaddr, int len, - asection * bfd_section)); - extern int target_write_memory PARAMS ((CORE_ADDR, char *, int)); @@ -1388,7 +1384,6 @@ extern int baud_rate; /* Timeout limit for response from target. */ extern int remote_timeout; -extern asection *target_memory_bfd_section; /* Functions for helping to write a native target. */ diff --git a/gdb/valops.c b/gdb/valops.c index 710c2be2e70..14e9294b62e 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -465,7 +465,7 @@ value_at (type, addr, sect) store_address (VALUE_CONTENTS_RAW (val), 4, num); } else - read_memory_section (addr, VALUE_CONTENTS_ALL_RAW (val), TYPE_LENGTH (type), sect); + read_memory (addr, VALUE_CONTENTS_ALL_RAW (val), TYPE_LENGTH (type)); VALUE_LVAL (val) = lval_memory; VALUE_ADDRESS (val) = addr; @@ -540,8 +540,8 @@ value_fetch_lazy (val) store_address (VALUE_CONTENTS_RAW (val), 4, num); } else if (length) - read_memory_section (addr, VALUE_CONTENTS_ALL_RAW (val), length, - VALUE_BFD_SECTION (val)); + read_memory (addr, VALUE_CONTENTS_ALL_RAW (val), length); + VALUE_LAZY (val) = 0; return 0; } -- 2.30.2