* Makefile.in (ALLDEPFILES): Remove alphanbsd-nat.c.
[deliverable/binutils-gdb.git] / gdb / maint.c
index 3e1b63f6765edc35acc6814ce830135377d775f8..ddaa390b683b27e2f34090ca364cc33488333936 100644 (file)
@@ -1,5 +1,5 @@
 /* Support for GDB maintenance commands.
-   Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001
+   Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002
    Free Software Foundation, Inc.
    Written by Fred Fish at Cygnus Support.
 
@@ -36,6 +36,8 @@
 #include "objfiles.h"
 #include "value.h"
 
+#include "cli/cli-decode.h"
+
 extern void _initialize_maint_cmds (void);
 
 static void maintenance_command (char *, int);
@@ -189,22 +191,22 @@ maintenance_info_command (char *arg, int from_tty)
 /* Mini tokenizing lexer for 'maint info sections' command.  */
 
 static int
-match_substring (char *string, char *substr)
+match_substring (const char *string, const char *substr)
 {
   int substr_len = strlen(substr);
-  char *tok;
+  const char *tok;
 
   while ((tok = strstr (string, substr)) != NULL)
     {
       /* Got a partial match.  Is it a whole word? */
-      if (tok == string  ||
-         tok[-1] == ' ' ||
-         tok[-1] == '\t')
+      if (tok == string
+         || tok[-1] == ' '
+         || tok[-1] == '\t')
       {
        /* Token is delimited at the front... */
-       if (tok[substr_len] == ' ' ||
-           tok[substr_len] == '\t' ||
-           tok[substr_len] == '\0')
+       if (tok[substr_len] == ' '
+           || tok[substr_len] == '\t'
+           || tok[substr_len] == '\0')
        {
          /* Token is delimited at the rear.  Got a whole-word match.  */
          return 1;
@@ -289,14 +291,14 @@ print_bfd_flags (flagword flags)
 }
 
 static void
-print_section_info (const char *name, flagword flags, 
-                   CORE_ADDR addr, CORE_ADDR endaddr, 
-                   unsigned long filepos)
+maint_print_section_info (const char *name, flagword flags, 
+                         CORE_ADDR addr, CORE_ADDR endaddr, 
+                         unsigned long filepos)
 {
   /* FIXME-32x64: Need print_address_numeric with field width.  */
   printf_filtered ("    0x%s", paddr (addr));
   printf_filtered ("->0x%s", paddr (endaddr));
-  printf_filtered (" at 0x%s",
+  printf_filtered (" at %s",
                   local_hex_string_custom ((unsigned long) filepos, "08l"));
   printf_filtered (": %s", name);
   print_bfd_flags (flags);
@@ -311,15 +313,15 @@ print_bfd_section_info (bfd *abfd,
   flagword flags = bfd_get_section_flags (abfd, asect);
   const char *name = bfd_section_name (abfd, asect);
 
-  if (arg == NULL || *((char *) arg) == '\0' ||
-      match_substring ((char *) arg, name) ||
-      match_bfd_flags ((char *) arg, flags))
+  if (arg == NULL || *((char *) arg) == '\0'
+      || match_substring ((char *) arg, name)
+      || match_bfd_flags ((char *) arg, flags))
     {
       CORE_ADDR addr, endaddr;
 
       addr = bfd_section_vma (abfd, asect);
       endaddr = addr + bfd_section_size (abfd, asect);
-      print_section_info (name, flags, addr, endaddr, asect->filepos);
+      maint_print_section_info (name, flags, addr, endaddr, asect->filepos);
     }
 }
 
@@ -331,11 +333,11 @@ print_objfile_section_info (bfd *abfd,
   flagword flags = bfd_get_section_flags (abfd, asect->the_bfd_section);
   const char *name = bfd_section_name (abfd, asect->the_bfd_section);
 
-  if (string == NULL || *string == '\0' ||
-      match_substring (string, name) ||
-      match_bfd_flags (string, flags))
+  if (string == NULL || *string == '\0'
+      || match_substring (string, name)
+      || match_bfd_flags (string, flags))
     {
-      print_section_info (name, flags, asect->addr, asect->endaddr, 
+      maint_print_section_info (name, flags, asect->addr, asect->endaddr, 
                          asect->the_bfd_section->filepos);
     }
 }
@@ -652,7 +654,7 @@ to test internal functions such as the C++ demangler, etc.",
   add_alias_cmd ("i", "info", class_maintenance, 1, &maintenancelist);
 
   add_cmd ("sections", class_maintenance, maintenance_info_sections,
-          "List the BFD sections of the exec and core files. \n
+          "List the BFD sections of the exec and core files. \n\
 Arguments may be any combination of:\n\
        [one or more section names]\n\
        ALLOC LOAD RELOC READONLY CODE DATA ROM CONSTRUCTOR\n\
@@ -790,7 +792,7 @@ passes without a response from the target, an error occurs.", &setlist),
                        "Set internal profiling.\n\
 When enabled GDB is profiled.",
                        &maintenance_set_cmdlist);
-  tmpcmd->function.sfunc = maintenance_set_profile_cmd;
+  set_cmd_sfunc (tmpcmd, maintenance_set_profile_cmd);
   add_show_from_set (tmpcmd, &maintenance_show_cmdlist);
 #endif
 }
This page took 0.040669 seconds and 4 git commands to generate.