summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElena Zannoni <ezannoni@kwikemart.cygnus.com>2004-01-14 18:39:08 +0000
committerElena Zannoni <ezannoni@kwikemart.cygnus.com>2004-01-14 18:39:08 +0000
commitf23273b0f56b6e345ffc0d8a8c38f9e69808b580 (patch)
treee9d197e09f1db2520a4f4952344f83f7dd763525
parentb23c12218e0c07b4e5766f86e3db59dff1100b60 (diff)
downloadgdb-f23273b0f56b6e345ffc0d8a8c38f9e69808b580.tar.gz
2004-01-14 Elena Zannoni <ezannoni@redhat.com>
* gcore.c (gcore_copy_callback): Use paddr_d to print size variable. (gcore_create_callback): Ditto. Skip any memory segment that has no permissions set.
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/gcore.c24
2 files changed, 26 insertions, 5 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d6e088dc85b..72036efde89 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2004-01-14 Elena Zannoni <ezannoni@redhat.com>
+
+ * gcore.c (gcore_copy_callback): Use paddr_d to print size
+ variable.
+ (gcore_create_callback): Ditto. Skip any memory segment that has
+ no permissions set.
+
2004-01-14 David Carlton <carlton@kealia.com>
Change symbols for C++ nested types to contain the fully qualified
diff --git a/gdb/gcore.c b/gdb/gcore.c
index d1525ddbb05..b5513728ef5 100644
--- a/gdb/gcore.c
+++ b/gdb/gcore.c
@@ -1,6 +1,6 @@
/* Generate a core file for the inferior process.
- Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GDB.
@@ -314,6 +314,20 @@ gcore_create_callback (CORE_ADDR vaddr, unsigned long size,
asection *osec;
flagword flags = SEC_ALLOC | SEC_HAS_CONTENTS | SEC_LOAD;
+ /* If the memory segment has no permissions set, ignore it, otherwise
+ when we later try to access it for read/write, we'll get an error
+ or jam the kernel. */
+ if (read == 0 && write == 0 && exec == 0)
+ {
+ if (info_verbose)
+ {
+ fprintf_filtered (gdb_stdout, "Ignore segment, %s bytes at 0x%s\n",
+ paddr_d (size), paddr_nz (vaddr));
+ }
+
+ return 0;
+ }
+
if (write == 0)
{
/* See if this region of memory lies inside a known file on disk.
@@ -364,8 +378,8 @@ gcore_create_callback (CORE_ADDR vaddr, unsigned long size,
if (info_verbose)
{
- fprintf_filtered (gdb_stdout, "Save segment, %lld bytes at 0x%s\n",
- (long long) size, paddr_nz (vaddr));
+ fprintf_filtered (gdb_stdout, "Save segment, %s bytes at 0x%s\n",
+ paddr_d (size), paddr_nz (vaddr));
}
bfd_set_section_size (obfd, osec, size);
@@ -450,8 +464,8 @@ gcore_copy_callback (bfd *obfd, asection *osec, void *ignored)
if (target_read_memory (bfd_section_vma (obfd, osec),
memhunk, size) != 0)
- warning ("Memory read failed for corefile section, %ld bytes at 0x%s\n",
- (long) size, paddr (bfd_section_vma (obfd, osec)));
+ warning ("Memory read failed for corefile section, %s bytes at 0x%s\n",
+ paddr_d (size), paddr (bfd_section_vma (obfd, osec)));
if (!bfd_set_section_contents (obfd, osec, memhunk, 0, size))
warning ("Failed to write corefile contents (%s).",
bfd_errmsg (bfd_get_error ()));