Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1480)

Unified Diff: gdb/gcore.c

Issue 11969036: Merge GDB 7.5.1 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@master
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gdb/frv-tdep.c ('k') | gdb/gdb.1 » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gdb/gcore.c
diff --git a/gdb/gcore.c b/gdb/gcore.c
index f9e7590f907e24a80d8ac9b187cca019b7c01605..aedda412eb6771adccb86983cdb977a4c3ccd748 100644
--- a/gdb/gcore.c
+++ b/gdb/gcore.c
@@ -71,35 +71,37 @@ write_gcore_file (bfd *obfd)
asection *note_sec = NULL;
/* An external target method must build the notes section. */
- note_data = target_make_corefile_notes (obfd, &note_size);
+ /* FIXME: uweigand/2011-10-06: All architectures that support core file
+ generation should be converted to gdbarch_make_corefile_notes; at that
+ point, the target vector method can be removed. */
+ if (!gdbarch_make_corefile_notes_p (target_gdbarch))
+ note_data = target_make_corefile_notes (obfd, &note_size);
+ else
+ note_data = gdbarch_make_corefile_notes (target_gdbarch, obfd, &note_size);
- /* Create the note section. */
- if (note_data != NULL && note_size != 0)
- {
- note_sec = bfd_make_section_anyway_with_flags (obfd, "note0",
- SEC_HAS_CONTENTS
- | SEC_READONLY
- | SEC_ALLOC);
- if (note_sec == NULL)
- error (_("Failed to create 'note' section for corefile: %s"),
- bfd_errmsg (bfd_get_error ()));
+ if (note_data == NULL || note_size == 0)
+ error (_("Target does not support core file generation."));
- bfd_set_section_vma (obfd, note_sec, 0);
- bfd_set_section_alignment (obfd, note_sec, 0);
- bfd_set_section_size (obfd, note_sec, note_size);
- }
+ /* Create the note section. */
+ note_sec = bfd_make_section_anyway_with_flags (obfd, "note0",
+ SEC_HAS_CONTENTS
+ | SEC_READONLY
+ | SEC_ALLOC);
+ if (note_sec == NULL)
+ error (_("Failed to create 'note' section for corefile: %s"),
+ bfd_errmsg (bfd_get_error ()));
+
+ bfd_set_section_vma (obfd, note_sec, 0);
+ bfd_set_section_alignment (obfd, note_sec, 0);
+ bfd_set_section_size (obfd, note_sec, note_size);
/* Now create the memory/load sections. */
if (gcore_memory_sections (obfd) == 0)
error (_("gcore: failed to get corefile memory sections from target."));
/* Write out the contents of the note section. */
- if (note_data != NULL && note_size != 0)
- {
- if (!bfd_set_section_contents (obfd, note_sec, note_data, 0, note_size))
- warning (_("writing note section (%s)"),
- bfd_errmsg (bfd_get_error ()));
- }
+ if (!bfd_set_section_contents (obfd, note_sec, note_data, 0, note_size))
+ warning (_("writing note section (%s)"), bfd_errmsg (bfd_get_error ()));
}
static void
@@ -559,8 +561,14 @@ gcore_copy_callback (bfd *obfd, asection *osec, void *ignored)
static int
gcore_memory_sections (bfd *obfd)
{
- if (target_find_memory_regions (gcore_create_callback, obfd) != 0)
- return 0; /* FIXME: error return/msg? */
+ /* Try gdbarch method first, then fall back to target method. */
+ if (!gdbarch_find_memory_regions_p (target_gdbarch)
+ || gdbarch_find_memory_regions (target_gdbarch,
+ gcore_create_callback, obfd) != 0)
+ {
+ if (target_find_memory_regions (gcore_create_callback, obfd) != 0)
+ return 0; /* FIXME: error return/msg? */
+ }
/* Record phdrs for section-to-segment mapping. */
bfd_map_over_sections (obfd, make_output_phdrs, NULL);
« no previous file with comments | « gdb/frv-tdep.c ('k') | gdb/gdb.1 » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698