/* Core dump and executable file functions below target vector, for GDB.
- Copyright (C) 1986-2014 Free Software Foundation, Inc.
+ Copyright (C) 1986-2015 Free Software Foundation, Inc.
This file is part of GDB.
#include "symfile.h"
#include "exec.h"
#include "readline/readline.h"
-#include "exceptions.h"
#include "solib.h"
#include "filenames.h"
#include "progspace.h"
/* Don't sniff if we have support for register sets in
CORE_GDBARCH. */
- if (core_gdbarch
- && (gdbarch_iterate_over_regset_sections_p (core_gdbarch)
- || gdbarch_regset_from_core_section_p (core_gdbarch)))
+ if (core_gdbarch && gdbarch_iterate_over_regset_sections_p (core_gdbarch))
return NULL;
for (cf = core_file_fns; cf != NULL; cf = cf->next)
int fake_pid_p = 0;
struct inferior *inf;
- if (strncmp (bfd_section_name (abfd, asect), ".reg/", 5) != 0)
+ if (!startswith (bfd_section_name (abfd, asect), ".reg/"))
return;
core_tid = atoi (bfd_section_name (abfd, asect) + 5);
bfd *temp_bfd;
int scratch_chan;
int flags;
- volatile struct gdb_exception except;
char *filename;
target_preopen (from_tty);
may be a thread_stratum target loaded on top of target core by
now. The layer above should claim threads found in the BFD
sections. */
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
- target_find_new_threads ();
+ target_update_thread_list ();
}
- if (except.reason < 0)
- exception_print (gdb_stderr, except);
+ CATCH (except, RETURN_MASK_ERROR)
+ {
+ exception_print (gdb_stderr, except);
+ }
+ END_CATCH
p = bfd_core_file_failing_command (core_bfd);
if (p)
/* Now, set up the frame cache, and print the top of stack. */
reinit_frame_cache ();
print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
+
+ /* Current thread should be NUM 1 but the user does not know that.
+ If a program is single threaded gdb in general does not mention
+ anything about threads. That is why the test is >= 2. */
+ if (thread_count () >= 2)
+ {
+ TRY
+ {
+ thread_command (NULL, from_tty);
+ }
+ CATCH (except, RETURN_MASK_ERROR)
+ {
+ exception_print (gdb_stderr, except);
+ }
+ END_CATCH
+ }
}
static void
warning (_("Section `%s' in core file too small."), section_name);
return;
}
+ if (size != min_size && !(regset->flags & REGSET_VARIABLE_SIZE))
+ {
+ warning (_("Unexpected size of section `%s' in core file."),
+ section_name);
+ }
contents = alloca (size);
if (! bfd_get_section_contents (core_bfd, section, contents,
return;
}
- if (regset == NULL
- && core_gdbarch && gdbarch_regset_from_core_section_p (core_gdbarch))
- {
- regset = gdbarch_regset_from_core_section (core_gdbarch,
- name, size);
- if (regset == NULL)
- {
- if (required)
- warning (_("Couldn't recognize %s registers in core file."),
- human_name);
- return;
- }
- }
-
if (regset != NULL)
{
regset->supply_regset (regset, regcache, -1, contents, size);
int i;
struct gdbarch *gdbarch;
- if (!(core_gdbarch
- && (gdbarch_iterate_over_regset_sections_p (core_gdbarch)
- || gdbarch_regset_from_core_section_p (core_gdbarch)))
+ if (!(core_gdbarch && gdbarch_iterate_over_regset_sections_p (core_gdbarch))
&& (core_vec == NULL || core_vec->core_read_registers == NULL))
{
fprintf_filtered (gdb_stderr,
/* Otherwise, this isn't a "threaded" core -- use the PID field, but
only if it isn't a fake PID. */
- inf = find_inferior_pid (ptid_get_pid (ptid));
+ inf = find_inferior_ptid (ptid);
if (inf != NULL && !inf->fake_pid_p)
return normal_pid_to_str (ptid);