* exec.c (exec_file_command): If error occurs after we have opened
exec_bfd but before we call push_target, make sure to close exec_bfd.
This commit is contained in:
parent
b2f03c3027
commit
b02fd8caa2
2 changed files with 41 additions and 16 deletions
|
@ -1,5 +1,8 @@
|
||||||
Sun Dec 26 16:59:39 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
|
Sun Dec 26 16:59:39 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
|
||||||
|
|
||||||
|
* exec.c (exec_file_command): If error occurs after we have opened
|
||||||
|
exec_bfd but before we call push_target, make sure to close exec_bfd.
|
||||||
|
|
||||||
* infrun.c (wait_for_inferior): Remove confusing and inaccurate
|
* infrun.c (wait_for_inferior): Remove confusing and inaccurate
|
||||||
stuff about subroutine calls, return, etc., from comment which
|
stuff about subroutine calls, return, etc., from comment which
|
||||||
says "We've wandered out of the step range.".
|
says "We've wandered out of the step range.".
|
||||||
|
|
42
gdb/exec.c
42
gdb/exec.c
|
@ -22,6 +22,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
#include "inferior.h"
|
#include "inferior.h"
|
||||||
#include "target.h"
|
#include "target.h"
|
||||||
#include "gdbcmd.h"
|
#include "gdbcmd.h"
|
||||||
|
#include "language.h"
|
||||||
|
|
||||||
#ifdef USG
|
#ifdef USG
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -150,25 +151,46 @@ exec_file_command (args, from_tty)
|
||||||
error ("Could not open `%s' as an executable file: %s",
|
error ("Could not open `%s' as an executable file: %s",
|
||||||
scratch_pathname, bfd_errmsg (bfd_error));
|
scratch_pathname, bfd_errmsg (bfd_error));
|
||||||
if (!bfd_check_format (exec_bfd, bfd_object))
|
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.",
|
error ("\"%s\": not in executable format: %s.",
|
||||||
scratch_pathname, bfd_errmsg (bfd_error));
|
scratch_pathname, bfd_errmsg (bfd_error));
|
||||||
|
}
|
||||||
|
|
||||||
if (build_section_table (exec_bfd, &exec_ops.to_sections,
|
if (build_section_table (exec_bfd, &exec_ops.to_sections,
|
||||||
&exec_ops.to_sections_end))
|
&exec_ops.to_sections_end))
|
||||||
|
{
|
||||||
|
/* Make sure to close exec_bfd, or else "run" might try to use
|
||||||
|
it. */
|
||||||
|
exec_close (0);
|
||||||
error ("Can't find the file sections in `%s': %s",
|
error ("Can't find the file sections in `%s': %s",
|
||||||
exec_bfd->filename, bfd_errmsg (bfd_error));
|
exec_bfd->filename, bfd_errmsg (bfd_error));
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef NEED_TEXT_START_END
|
#ifdef NEED_TEXT_START_END
|
||||||
/* This is a KLUDGE (FIXME) because a few places in a few ports
|
|
||||||
(29K springs to mind) need this info for now. */
|
/* text_end is sometimes used for where to put call dummies. A
|
||||||
|
few ports use these for other purposes too. */
|
||||||
|
|
||||||
{
|
{
|
||||||
struct section_table *p;
|
struct section_table *p;
|
||||||
|
|
||||||
|
/* Set text_start to the lowest address of the start of any
|
||||||
|
readonly code section and set text_end to the highest
|
||||||
|
address of the end of any readonly code section. */
|
||||||
|
|
||||||
|
text_start = ~(CORE_ADDR)0;
|
||||||
|
text_end = (CORE_ADDR)0;
|
||||||
for (p = exec_ops.to_sections; p < exec_ops.to_sections_end; p++)
|
for (p = exec_ops.to_sections; p < exec_ops.to_sections_end; p++)
|
||||||
if (STREQ (".text", bfd_section_name (p->bfd, p->sec_ptr)))
|
if (bfd_get_section_flags (p->bfd, p->sec_ptr)
|
||||||
|
& (SEC_CODE | SEC_READONLY))
|
||||||
{
|
{
|
||||||
|
if (text_start > p->addr)
|
||||||
text_start = p->addr;
|
text_start = p->addr;
|
||||||
|
if (text_end < p->endaddr)
|
||||||
text_end = p->endaddr;
|
text_end = p->endaddr;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -182,7 +204,7 @@ exec_file_command (args, from_tty)
|
||||||
(*exec_file_display_hook) (filename);
|
(*exec_file_display_hook) (filename);
|
||||||
}
|
}
|
||||||
else if (from_tty)
|
else if (from_tty)
|
||||||
printf ("No exec file now.\n");
|
printf_unfiltered ("No exec file now.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set both the exec file and the symbol file, in one command.
|
/* Set both the exec file and the symbol file, in one command.
|
||||||
|
@ -344,13 +366,13 @@ print_section_info (t, abfd)
|
||||||
wrap_here (" ");
|
wrap_here (" ");
|
||||||
printf_filtered ("file type %s.\n", bfd_get_target(abfd));
|
printf_filtered ("file type %s.\n", bfd_get_target(abfd));
|
||||||
printf_filtered ("\tEntry point: %s\n",
|
printf_filtered ("\tEntry point: %s\n",
|
||||||
local_hex_string (bfd_get_start_address (exec_bfd)));
|
local_hex_string ((unsigned long) bfd_get_start_address (exec_bfd)));
|
||||||
for (p = t->to_sections; p < t->to_sections_end; p++) {
|
for (p = t->to_sections; p < t->to_sections_end; p++) {
|
||||||
printf_filtered ("\t%s", local_hex_string_custom (p->addr, "08"));
|
printf_filtered ("\t%s", local_hex_string_custom ((unsigned long) p->addr, "08l"));
|
||||||
printf_filtered (" - %s", local_hex_string_custom (p->endaddr, "08"));
|
printf_filtered (" - %s", local_hex_string_custom ((unsigned long) p->endaddr, "08l"));
|
||||||
if (info_verbose)
|
if (info_verbose)
|
||||||
printf_filtered (" @ %s",
|
printf_filtered (" @ %s",
|
||||||
local_hex_string_custom (p->sec_ptr->filepos, "08"));
|
local_hex_string_custom ((unsigned long) p->sec_ptr->filepos, "08l"));
|
||||||
printf_filtered (" is %s", bfd_section_name (p->bfd, p->sec_ptr));
|
printf_filtered (" is %s", bfd_section_name (p->bfd, p->sec_ptr));
|
||||||
if (p->bfd != abfd) {
|
if (p->bfd != abfd) {
|
||||||
printf_filtered (" in %s", bfd_get_filename (p->bfd));
|
printf_filtered (" in %s", bfd_get_filename (p->bfd));
|
||||||
|
@ -407,7 +429,7 @@ set_section_command (args, from_tty)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If mourn is being called in all the right places, this could be say
|
/* If mourn is being called in all the right places, this could be say
|
||||||
`gdb internal error' (since generic_mourn calls mark_breakpoints_out). */
|
`gdb internal error' (since generic_mourn calls breakpoint_init_inferior). */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ignore (addr, contents)
|
ignore (addr, contents)
|
||||||
|
|
Loading…
Reference in a new issue