aboutsummaryrefslogtreecommitdiff
path: root/gdb/maint.c
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@vmware.com>2001-12-20 21:03:03 +0000
committerMichael Snyder <msnyder@vmware.com>2001-12-20 21:03:03 +0000
commit43155bc16721b8ae7b40149f01df8ad98c4ad7f5 (patch)
tree7b1f0d69d9532e84d851b3e538ec63f356f40351 /gdb/maint.c
parentfd29389c60cc4467763e7fe12229c95d31a779e8 (diff)
downloadgdb-43155bc16721b8ae7b40149f01df8ad98c4ad7f5.zip
gdb-43155bc16721b8ae7b40149f01df8ad98c4ad7f5.tar.gz
gdb-43155bc16721b8ae7b40149f01df8ad98c4ad7f5.tar.bz2
2001-12-20 Michael Snyder <msnyder@redhat.com>
* maint.c (maintenance_info_sections): Pass string argument to print_section_table, so that it can be used to select sections. (print_section_table): Change PTR to void *. Look at string arg to select sections by name and by flag attributes. (match_bfd_flags): New function. (print_bfd_flags): New function.
Diffstat (limited to 'gdb/maint.c')
-rw-r--r--gdb/maint.c100
1 files changed, 78 insertions, 22 deletions
diff --git a/gdb/maint.c b/gdb/maint.c
index 31f97fc..56f19f3 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -52,7 +52,7 @@ static void maintenance_space_display (char *, int);
static void maintenance_info_command (char *, int);
-static void print_section_table (bfd *, asection *, PTR);
+static void print_section_table (bfd *, asection *, void *);
static void maintenance_info_sections (char *, int);
@@ -186,27 +186,52 @@ maintenance_info_command (char *arg, int from_tty)
help_list (maintenanceinfolist, "maintenance info ", -1, gdb_stdout);
}
-static void
-print_section_table (bfd *abfd, asection *asect, PTR ignore)
+static int
+match_bfd_flags (char *string, flagword flags)
{
- flagword flags;
-
- flags = bfd_get_section_flags (abfd, asect);
+ if (flags & SEC_ALLOC)
+ if (strstr (string, "ALLOC"))
+ return 1;
+ if (flags & SEC_LOAD)
+ if (strstr (string, "LOAD"))
+ return 1;
+ if (flags & SEC_RELOC)
+ if (strstr (string, "RELOC"))
+ return 1;
+ if (flags & SEC_READONLY)
+ if (strstr (string, "READONLY"))
+ return 1;
+ if (flags & SEC_CODE)
+ if (strstr (string, "CODE"))
+ return 1;
+ if (flags & SEC_DATA)
+ if (strstr (string, "DATA"))
+ return 1;
+ if (flags & SEC_ROM)
+ if (strstr (string, "ROM"))
+ return 1;
+ if (flags & SEC_CONSTRUCTOR)
+ if (strstr (string, "CONSTRUCTOR"))
+ return 1;
+ if (flags & SEC_HAS_CONTENTS)
+ if (strstr (string, "HAS_CONTENTS"))
+ return 1;
+ if (flags & SEC_NEVER_LOAD)
+ if (strstr (string, "NEVER_LOAD"))
+ return 1;
+ if (flags & SEC_COFF_SHARED_LIBRARY)
+ if (strstr (string, "COFF_SHARED_LIBRARY"))
+ return 1;
+ if (flags & SEC_IS_COMMON)
+ if (strstr (string, "IS_COMMON"))
+ return 1;
- /* FIXME-32x64: Need print_address_numeric with field width. */
- printf_filtered (" %s",
- local_hex_string_custom
- ((unsigned long) bfd_section_vma (abfd, asect), "08l"));
- printf_filtered ("->%s",
- local_hex_string_custom
- ((unsigned long) (bfd_section_vma (abfd, asect)
- + bfd_section_size (abfd, asect)),
- "08l"));
- printf_filtered (" at %s",
- local_hex_string_custom
- ((unsigned long) asect->filepos, "08l"));
- printf_filtered (": %s", bfd_section_name (abfd, asect));
+ return 0;
+}
+static void
+print_bfd_flags (flagword flags)
+{
if (flags & SEC_ALLOC)
printf_filtered (" ALLOC");
if (flags & SEC_LOAD)
@@ -231,8 +256,39 @@ print_section_table (bfd *abfd, asection *asect, PTR ignore)
printf_filtered (" COFF_SHARED_LIBRARY");
if (flags & SEC_IS_COMMON)
printf_filtered (" IS_COMMON");
+}
+
+static void
+print_section_table (bfd *abfd, asection *asect, void *arg)
+{
+ flagword flags;
+ char *string = arg;
- printf_filtered ("\n");
+ flags = bfd_get_section_flags (abfd, asect);
+
+ if (string == NULL || *string == '\0' ||
+ strstr (string, bfd_get_section_name (abfd, asect)) ||
+ match_bfd_flags (string, flags))
+ {
+ /* FIXME-32x64: Need print_address_numeric with field width. */
+ printf_filtered (" %s",
+ local_hex_string_custom
+ ((unsigned long) bfd_section_vma (abfd, asect),
+ "08l"));
+ printf_filtered ("->%s",
+ local_hex_string_custom
+ ((unsigned long) (bfd_section_vma (abfd, asect)
+ + bfd_section_size (abfd, asect)),
+ "08l"));
+ printf_filtered (" at %s",
+ local_hex_string_custom
+ ((unsigned long) asect->filepos, "08l"));
+ printf_filtered (": %s", bfd_section_name (abfd, asect));
+
+ print_bfd_flags (flags);
+
+ printf_filtered ("\n");
+ }
}
/* ARGSUSED */
@@ -245,7 +301,7 @@ maintenance_info_sections (char *arg, int from_tty)
printf_filtered (" `%s', ", bfd_get_filename (exec_bfd));
wrap_here (" ");
printf_filtered ("file type %s.\n", bfd_get_target (exec_bfd));
- bfd_map_over_sections (exec_bfd, print_section_table, 0);
+ bfd_map_over_sections (exec_bfd, print_section_table, arg);
}
if (core_bfd)
@@ -254,7 +310,7 @@ maintenance_info_sections (char *arg, int from_tty)
printf_filtered (" `%s', ", bfd_get_filename (core_bfd));
wrap_here (" ");
printf_filtered ("file type %s.\n", bfd_get_target (core_bfd));
- bfd_map_over_sections (core_bfd, print_section_table, 0);
+ bfd_map_over_sections (core_bfd, print_section_table, arg);
}
}