* 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.
This commit is contained in:
parent
f61b81b7c1
commit
c4a081e172
9 changed files with 68 additions and 45 deletions
|
@ -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.
|
||||
|
|
|
@ -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();
|
||||
|
|
39
gdb/exec.c
39
gdb/exec.c
|
@ -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
|
||||
|
|
|
@ -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++)
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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++)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue