+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.
{
/* 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. */
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);
{
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. */
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();
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,
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
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;
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
{
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;
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++)
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. */
{
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;
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++)
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 */
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);
{
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;
}
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),
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;
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);
{
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)
{
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);
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)
/* 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);
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.");
/* 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. */
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
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();