diff options
author | David MacKenzie <djm@cygnus> | 1994-02-17 18:19:25 +0000 |
---|---|---|
committer | David MacKenzie <djm@cygnus> | 1994-02-17 18:19:25 +0000 |
commit | c4a081e17239660420dbfed33542e865ce932ea4 (patch) | |
tree | 0bdeccbe4873348f142a7f8d3e9a08573a6116ea /gdb | |
parent | f61b81b7c1ca5c2de10a9dd6294ced660ef92cbc (diff) | |
download | gdb-c4a081e17239660420dbfed33542e865ce932ea4.zip gdb-c4a081e17239660420dbfed33542e865ce932ea4.tar.gz gdb-c4a081e17239660420dbfed33542e865ce932ea4.tar.bz2 |
* corelow.c, exec.c, irix5-nat.c, mipsread.c, objfiles.c,
osfsolib.c, rs6000-nat.c, solib.c, symfile.c, utils.c,
xcoffexec.c: Use bfd_get_error and bfd_set_error and new error names.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/corelow.c | 8 | ||||
-rw-r--r-- | gdb/exec.c | 39 | ||||
-rw-r--r-- | gdb/irix5-nat.c | 6 | ||||
-rw-r--r-- | gdb/objfiles.c | 2 | ||||
-rw-r--r-- | gdb/osfsolib.c | 6 | ||||
-rw-r--r-- | gdb/rs6000-nat.c | 6 | ||||
-rw-r--r-- | gdb/symfile.c | 32 | ||||
-rw-r--r-- | gdb/xcoffexec.c | 8 |
9 files changed, 68 insertions, 45 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 0e2a549..b95330f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +Thu Feb 17 09:30:22 1994 David J. Mackenzie (djm@thepub.cygnus.com) + + * corelow.c, exec.c, irix5-nat.c, mipsread.c, objfiles.c, + osfsolib.c, rs6000-nat.c, solib.c, symfile.c, utils.c, + xcoffexec.c: Use bfd_get_error and bfd_set_error and new error names. + Fri Feb 11 21:47:24 1994 Steve Chamberlain (sac@sphagnum.cygnus.com) * remote-hms.c (readchar, hms_open, hms_fetch_register): Made more robust. diff --git a/gdb/corelow.c b/gdb/corelow.c index 9d7c252..cc0d4f0 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -155,7 +155,7 @@ core_open (filename, from_tty) { /* Do it after the err msg */ make_cleanup (bfd_close, temp_bfd); - error ("\"%s\" is not a core dump: %s", filename, bfd_errmsg(bfd_error)); + error ("\"%s\" is not a core dump: %s", filename, bfd_errmsg(bfd_get_error ())); } /* Looks semi-reasonable. Toss the old core file and work on the new. */ @@ -171,7 +171,7 @@ core_open (filename, from_tty) if (build_section_table (core_bfd, &core_ops.to_sections, &core_ops.to_sections_end)) error ("Can't find sections in `%s': %s", bfd_get_filename(core_bfd), - bfd_errmsg (bfd_error)); + bfd_errmsg (bfd_get_error ())); ontop = !push_target (&core_ops); discard_cleanups (old_chain); @@ -265,7 +265,7 @@ get_core_registers (regno) { cant: fprintf_filtered (gdb_stderr, "Couldn't fetch registers from core file: %s\n", - bfd_errmsg (bfd_error)); + bfd_errmsg (bfd_get_error ())); } /* Now do it again for the float registers, if they exist. */ @@ -282,7 +282,7 @@ cant: else { fprintf_filtered (gdb_stderr, "Couldn't fetch register set 2 from core file: %s\n", - bfd_errmsg (bfd_error)); + bfd_errmsg (bfd_get_error ())); } } registers_fetched(); @@ -149,14 +149,14 @@ exec_file_command (args, from_tty) exec_bfd = bfd_fdopenr (scratch_pathname, gnutarget, scratch_chan); if (!exec_bfd) error ("Could not open `%s' as an executable file: %s", - scratch_pathname, bfd_errmsg (bfd_error)); + scratch_pathname, bfd_errmsg (bfd_get_error ())); if (!bfd_check_format (exec_bfd, bfd_object)) { /* Make sure to close exec_bfd, or else "run" might try to use it. */ exec_close (0); error ("\"%s\": not in executable format: %s.", - scratch_pathname, bfd_errmsg (bfd_error)); + scratch_pathname, bfd_errmsg (bfd_get_error ())); } if (build_section_table (exec_bfd, &exec_ops.to_sections, @@ -166,7 +166,7 @@ exec_file_command (args, from_tty) it. */ exec_close (0); error ("Can't find the file sections in `%s': %s", - exec_bfd->filename, bfd_errmsg (bfd_error)); + exec_bfd->filename, bfd_errmsg (bfd_get_error ())); } #ifdef NEED_TEXT_START_END @@ -237,8 +237,7 @@ add_to_section_table (abfd, asect, table_pp_char) flagword aflag; aflag = bfd_get_section_flags (abfd, asect); - /* FIXME, we need to handle BSS segment here...it alloc's but doesn't load */ - if (!(aflag & SEC_LOAD)) + if (!(aflag & SEC_ALLOC)) return; if (0 == bfd_section_size (abfd, asect)) return; @@ -365,20 +364,24 @@ print_section_info (t, abfd) printf_filtered ("\t`%s', ", bfd_get_filename(abfd)); wrap_here (" "); printf_filtered ("file type %s.\n", bfd_get_target(abfd)); - printf_filtered ("\tEntry point: %s\n", - local_hex_string ((unsigned long) bfd_get_start_address (exec_bfd))); - for (p = t->to_sections; p < t->to_sections_end; p++) { - printf_filtered ("\t%s", local_hex_string_custom ((unsigned long) p->addr, "08l")); - printf_filtered (" - %s", local_hex_string_custom ((unsigned long) p->endaddr, "08l")); - if (info_verbose) - printf_filtered (" @ %s", - local_hex_string_custom ((unsigned long) p->sec_ptr->filepos, "08l")); - printf_filtered (" is %s", bfd_section_name (p->bfd, p->sec_ptr)); - if (p->bfd != abfd) { - printf_filtered (" in %s", bfd_get_filename (p->bfd)); + printf_filtered ("\tEntry point: "); + print_address_numeric (bfd_get_start_address (exec_bfd), gdb_stdout); + printf_filtered ("\n"); + for (p = t->to_sections; p < t->to_sections_end; p++) + { + /* FIXME-32x64 need a print_address_numeric with field width */ + printf_filtered ("\t%s", local_hex_string_custom ((unsigned long) p->addr, "08l")); + printf_filtered (" - %s", local_hex_string_custom ((unsigned long) p->endaddr, "08l")); + if (info_verbose) + printf_filtered (" @ %s", + local_hex_string_custom ((unsigned long) p->sec_ptr->filepos, "08l")); + printf_filtered (" is %s", bfd_section_name (p->bfd, p->sec_ptr)); + if (p->bfd != abfd) + { + printf_filtered (" in %s", bfd_get_filename (p->bfd)); + } + printf_filtered ("\n"); } - printf_filtered ("\n"); - } } static void diff --git a/gdb/irix5-nat.c b/gdb/irix5-nat.c index 0ae328f..9057964 100644 --- a/gdb/irix5-nat.c +++ b/gdb/irix5-nat.c @@ -325,7 +325,7 @@ solib_map_sections (so) { close (scratch_chan); error ("Could not open `%s' as an executable file: %s", - scratch_pathname, bfd_errmsg (bfd_error)); + scratch_pathname, bfd_errmsg (bfd_get_error ())); } /* Leave bfd open, core_xfer_memory and "info files" need it. */ so -> abfd = abfd; @@ -334,12 +334,12 @@ solib_map_sections (so) if (!bfd_check_format (abfd, bfd_object)) { error ("\"%s\": not in executable format: %s.", - scratch_pathname, bfd_errmsg (bfd_error)); + scratch_pathname, bfd_errmsg (bfd_get_error ())); } if (build_section_table (abfd, &so -> sections, &so -> sections_end)) { error ("Can't find the file sections in `%s': %s", - bfd_get_filename (exec_bfd), bfd_errmsg (bfd_error)); + bfd_get_filename (exec_bfd), bfd_errmsg (bfd_get_error ())); } for (p = so -> sections; p < so -> sections_end; p++) diff --git a/gdb/objfiles.c b/gdb/objfiles.c index 4358f65..381a095 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -254,7 +254,7 @@ allocate_objfile (abfd, mapped) if (build_objfile_section_table (objfile)) { error ("Can't find the file sections in `%s': %s", - objfile -> name, bfd_errmsg (bfd_error)); + objfile -> name, bfd_errmsg (bfd_get_error ())); } /* Push this file onto the head of the linked list of other such files. */ diff --git a/gdb/osfsolib.c b/gdb/osfsolib.c index c86f084..55d20cf 100644 --- a/gdb/osfsolib.c +++ b/gdb/osfsolib.c @@ -189,7 +189,7 @@ solib_map_sections (so) { close (scratch_chan); error ("Could not open `%s' as an executable file: %s", - scratch_pathname, bfd_errmsg (bfd_error)); + scratch_pathname, bfd_errmsg (bfd_get_error ())); } /* Leave bfd open, core_xfer_memory and "info files" need it. */ so -> abfd = abfd; @@ -198,12 +198,12 @@ solib_map_sections (so) if (!bfd_check_format (abfd, bfd_object)) { error ("\"%s\": not in executable format: %s.", - scratch_pathname, bfd_errmsg (bfd_error)); + scratch_pathname, bfd_errmsg (bfd_get_error ())); } if (build_section_table (abfd, &so -> sections, &so -> sections_end)) { error ("Can't find the file sections in `%s': %s", - bfd_get_filename (exec_bfd), bfd_errmsg (bfd_error)); + bfd_get_filename (exec_bfd), bfd_errmsg (bfd_get_error ())); } for (p = so -> sections; p < so -> sections_end; p++) diff --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c index db8c580..1d8b5ec 100644 --- a/gdb/rs6000-nat.c +++ b/gdb/rs6000-nat.c @@ -380,7 +380,7 @@ add_vmap(ldi) abfd = bfd_fdopenr(objname, gnutarget, ldi->ldinfo_fd); if (!abfd) error("Could not open `%s' as an executable file: %s", - objname, bfd_errmsg(bfd_error)); + objname, bfd_errmsg(bfd_get_error ())); /* make sure we have an object file */ @@ -415,7 +415,7 @@ add_vmap(ldi) obj_err: bfd_close(abfd); error ("\"%s\": not in executable format: %s.", - objname, bfd_errmsg(bfd_error)); + objname, bfd_errmsg(bfd_get_error ())); /*NOTREACHED*/ } obj = allocate_objfile (vp->bfd, 0); @@ -651,7 +651,7 @@ xcoff_relocate_core () { bfd_err: fprintf_filtered (gdb_stderr, "Couldn't get ldinfo from core file: %s\n", - bfd_errmsg (bfd_error)); + bfd_errmsg (bfd_get_error ())); do_cleanups (old); return; } diff --git a/gdb/symfile.c b/gdb/symfile.c index 5202823..a0d7095 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -409,6 +409,7 @@ syms_from_objfile (objfile, addr, mainline, verbo) else if (0 == bfd_get_section_name (objfile->obfd, lowest_sect) || !STREQ (".text", bfd_get_section_name (objfile->obfd, lowest_sect))) + /* FIXME-32x64--assumes bfd_vma fits in long. */ warning ("Lowest section in %s is %s at 0x%lx", objfile->name, bfd_section_name (objfile->obfd, lowest_sect), @@ -757,7 +758,7 @@ symfile_bfd_open (name) close (desc); make_cleanup (free, name); error ("\"%s\": can't open to read symbols: %s.", name, - bfd_errmsg (bfd_error)); + bfd_errmsg (bfd_get_error ())); } sym_bfd->cacheable = true; @@ -766,7 +767,7 @@ symfile_bfd_open (name) bfd_close (sym_bfd); /* This also closes desc */ make_cleanup (free, name); error ("\"%s\": can't read symbols: %s.", name, - bfd_errmsg (bfd_error)); + bfd_errmsg (bfd_get_error ())); } return (sym_bfd); @@ -797,11 +798,16 @@ find_sym_fns (objfile) { struct sym_fns *sf; enum bfd_flavour our_flavour = bfd_get_flavour (objfile -> obfd); + char *our_target = bfd_get_target (objfile -> obfd); /* Special kludge for RS/6000. See xcoffread.c. */ - if (STREQ (bfd_get_target (objfile -> obfd), "aixcoff-rs6000")) + if (STREQ (our_target, "aixcoff-rs6000")) our_flavour = (enum bfd_flavour)-1; + /* Special kludge for apollo. See dstread.c. */ + if (STREQN (our_target, "apollo", 6)) + our_flavour = (enum bfd_flavour)-2; + for (sf = symtab_fns; sf != NULL; sf = sf -> next) { if (our_flavour == sf -> sym_flavour) @@ -839,7 +845,12 @@ generic_load (filename, from_tty) { struct cleanup *old_cleanups; asection *s; - bfd *loadfile_bfd = bfd_openr (filename, gnutarget); + bfd *loadfile_bfd; + + if (filename == NULL) + filename = get_exec_file (1); + + loadfile_bfd = bfd_openr (filename, gnutarget); if (loadfile_bfd == NULL) { perror_with_name (filename); @@ -850,7 +861,7 @@ generic_load (filename, from_tty) if (!bfd_check_format (loadfile_bfd, bfd_object)) { error ("\"%s\" is not an object file: %s", filename, - bfd_errmsg (bfd_error)); + bfd_errmsg (bfd_get_error ())); } for (s = loadfile_bfd->sections; s; s = s->next) @@ -873,9 +884,11 @@ generic_load (filename, from_tty) /* Is this really necessary? I guess it gives the user something to look at during a long download. */ - printf_filtered ("Loading section %s, size 0x%lx vma 0x%lx\n", + printf_filtered ("Loading section %s, size 0x%lx vma ", bfd_get_section_name (loadfile_bfd, s), - (unsigned long) size, (unsigned long) vma); + (unsigned long) size); + print_address_numeric (vma, gdb_stdout); + printf_filtered ("\n"); bfd_get_section_contents (loadfile_bfd, s, buffer, 0, size); @@ -968,6 +981,7 @@ add_symbol_file_command (args, from_tty) text_addr = parse_and_eval_address (args); + /* FIXME-32x64: Assumes text_addr fits in a long. */ if (!query ("add symbol table from file \"%s\" at text_addr = %s?\n", name, local_hex_string ((unsigned long)text_addr))) error ("Not confirmed."); @@ -1044,7 +1058,7 @@ reread_symbols () /* bfd_openr sets cacheable to true, which is what we want. */ if (!bfd_check_format (objfile->obfd, bfd_object)) error ("Can't read symbols from %s: %s.", objfile->name, - bfd_errmsg (bfd_error)); + bfd_errmsg (bfd_get_error ())); /* Save the offsets, we will nuke them with the rest of the psymbol_obstack. */ @@ -1099,7 +1113,7 @@ reread_symbols () if (build_objfile_section_table (objfile)) { error ("Can't find the file sections in `%s': %s", - objfile -> name, bfd_errmsg (bfd_error)); + objfile -> name, bfd_errmsg (bfd_get_error ())); } /* We use the same section offsets as from last time. I'm not diff --git a/gdb/xcoffexec.c b/gdb/xcoffexec.c index fb2aea1..95a713a 100644 --- a/gdb/xcoffexec.c +++ b/gdb/xcoffexec.c @@ -149,25 +149,25 @@ exec_file_command (filename, from_tty) exec_bfd = bfd_fdopenr(scratch_pathname, gnutarget, scratch_chan); if (!exec_bfd) error("Could not open `%s' as an executable file: %s", - scratch_pathname, bfd_errmsg(bfd_error)); + scratch_pathname, bfd_errmsg(bfd_get_error ())); /* make sure we have an object file */ if (!bfd_check_format(exec_bfd, bfd_object)) error("\"%s\": not in executable format: %s.", scratch_pathname, - bfd_errmsg(bfd_error)); + bfd_errmsg(bfd_get_error ())); /* setup initial vmap */ map_vmap (exec_bfd, 0); if (!vmap) error("Can't find the file sections in `%s': %s", exec_bfd->filename, - bfd_errmsg(bfd_error)); + bfd_errmsg(bfd_get_error ())); if (build_section_table (exec_bfd, &exec_ops.to_sections, &exec_ops.to_sections_end)) error ("Can't find the file sections in `%s': %s", exec_bfd->filename, - bfd_errmsg (bfd_error)); + bfd_errmsg (bfd_get_error ())); /* make sure core, if present, matches */ validate_files(); |