Constify arguments of gdb_bfd_lookup_symbol and related functions
authorSimon Marchi <simon.marchi@polymtl.ca>
Tue, 13 Oct 2015 16:40:01 +0000 (12:40 -0400)
committerSimon Marchi <simon.marchi@ericsson.com>
Tue, 13 Oct 2015 16:42:35 +0000 (12:42 -0400)
Fixes this error:

/home/pedro/gdb/mygit/src/gdb/solib-frv.c: In function â€˜int enable_break2()’:
/home/pedro/gdb/mygit/src/gdb/solib-frv.c:622:72: error: invalid conversion from â€˜const void*’ to â€˜void*’ [-fpermissive]
       addr = gdb_bfd_lookup_symbol (tmp_bfd, cmp_name, "_dl_debug_addr");
                                                                        ^
In file included from /home/pedro/gdb/mygit/src/gdb/solib-frv.c:23:0:
/home/pedro/gdb/mygit/src/gdb/solib.h:82:18: error:   initializing argument 3 of â€˜CORE_ADDR gdb_bfd_lookup_symbol(bfd*, int (*)(asymbol*, void*), void*)’ [-fpermissive]
 extern CORE_ADDR gdb_bfd_lookup_symbol (bfd *abfd,
                  ^

The call in question is:

      addr = gdb_bfd_lookup_symbol (tmp_bfd, cmp_name, "_dl_debug_addr");

gdb/ChangeLog:

* solib-dsbt.c (cmp_name): Constify arguments.
* solib-frv.c (cmp_name): Likewise.
* solib-svr4.c (svr4_create_solib_event_breakpoints): Likewise.
* solib.c (gdb_bfd_lookup_symbol_from_symtab): Likewise.
(bfd_lookup_symbol_from_dyn_symtab): Likewise.
(gdb_bfd_lookup_symbol): Likewise.
* solib.h (gdb_bfd_lookup_symbol): Likewise.
(gdb_bfd_lookup_symbol_from_symtab): Likewise.

gdb/ChangeLog
gdb/solib-dsbt.c
gdb/solib-frv.c
gdb/solib-svr4.c
gdb/solib.c
gdb/solib.h

index e77f1bd9493b173d2ed1a9856f7319ed384e4c4e..e96aa7c7ca25d55c86e4852c1fb2060255217035 100644 (file)
@@ -1,3 +1,14 @@
+2015-10-13  Simon Marchi  <thundersim@gmail.com>
+
+       * solib-dsbt.c (cmp_name): Constify arguments.
+       * solib-frv.c (cmp_name): Likewise.
+       * solib-svr4.c (svr4_create_solib_event_breakpoints): Likewise.
+       * solib.c (gdb_bfd_lookup_symbol_from_symtab): Likewise.
+       (bfd_lookup_symbol_from_dyn_symtab): Likewise.
+       (gdb_bfd_lookup_symbol): Likewise.
+       * solib.h (gdb_bfd_lookup_symbol): Likewise.
+       (gdb_bfd_lookup_symbol_from_symtab): Likewise.
+
 2015-10-12  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * stack.c (parse_frame_specification): Remove message parameter,
index 3218bbec6358f2238f4d065fc8da694ae1dd1735..d01f9db29a7797df7c487db9a41c9a955f7a9723 100644 (file)
@@ -777,7 +777,7 @@ enable_break_failure_warning (void)
 /* Helper function for gdb_bfd_lookup_symbol.  */
 
 static int
-cmp_name (asymbol *sym, void *data)
+cmp_name (const asymbol *sym, const void *data)
 {
   return (strcmp (sym->name, (const char *) data) == 0);
 }
index 922ee36a88a26919224b2bb1e56f49d251f36f28..451bbdfe23279fbfc38dce8fbca8a5cfc0636350 100644 (file)
@@ -484,7 +484,7 @@ enable_break_failure_warning (void)
 /* Helper function for gdb_bfd_lookup_symbol.  */
 
 static int
-cmp_name (asymbol *sym, void *data)
+cmp_name (const asymbol *sym, const void *data)
 {
   return (strcmp (sym->name, (const char *) data) == 0);
 }
index 55b8f5566774fb566c00c11b57840973278748d7..2dc1692ab1b0c9384e0e7f2f196d03d1def4a1ba 100644 (file)
@@ -2220,7 +2220,7 @@ svr4_create_solib_event_breakpoints (struct gdbarch *gdbarch,
 /* Helper function for gdb_bfd_lookup_symbol.  */
 
 static int
-cmp_name_and_sec_flags (asymbol *sym, void *data)
+cmp_name_and_sec_flags (const asymbol *sym, const void *data)
 {
   return (strcmp (sym->name, (const char *) data) == 0
          && (sym->section->flags & (SEC_CODE | SEC_DATA)) != 0);
@@ -2480,7 +2480,7 @@ enable_break (struct svr4_info *info, int from_tty)
       for (bkpt_namep = solib_break_names; *bkpt_namep != NULL; bkpt_namep++)
        {
          sym_addr = gdb_bfd_lookup_symbol (tmp_bfd, cmp_name_and_sec_flags,
-                                           (void *) *bkpt_namep);
+                                           *bkpt_namep);
          if (sym_addr != 0)
            break;
        }
index 9a6e7dee458ef9923bbe16338f68fe4bd0c4053d..ca2c9ab89c264e24101a1a7498ce2f9e6ace09ba 100644 (file)
@@ -1533,8 +1533,9 @@ solib_global_lookup (struct objfile *objfile,
 
 CORE_ADDR
 gdb_bfd_lookup_symbol_from_symtab (bfd *abfd,
-                                  int (*match_sym) (asymbol *, void *),
-                                  void *data)
+                                  int (*match_sym) (const asymbol *,
+                                                    const void *),
+                                  const void *data)
 {
   long storage_needed = bfd_get_symtab_upper_bound (abfd);
   CORE_ADDR symaddr = 0;
@@ -1592,8 +1593,9 @@ gdb_bfd_lookup_symbol_from_symtab (bfd *abfd,
 
 static CORE_ADDR
 bfd_lookup_symbol_from_dyn_symtab (bfd *abfd,
-                                  int (*match_sym) (asymbol *, void *),
-                                  void *data)
+                                  int (*match_sym) (const asymbol *,
+                                                    const void *),
+                                  const void *data)
 {
   long storage_needed = bfd_get_dynamic_symtab_upper_bound (abfd);
   CORE_ADDR symaddr = 0;
@@ -1630,8 +1632,8 @@ bfd_lookup_symbol_from_dyn_symtab (bfd *abfd,
 
 CORE_ADDR
 gdb_bfd_lookup_symbol (bfd *abfd,
-                      int (*match_sym) (asymbol *, void *),
-                      void *data)
+                      int (*match_sym) (const asymbol *, const void *),
+                      const void *data)
 {
   CORE_ADDR symaddr = gdb_bfd_lookup_symbol_from_symtab (abfd, match_sym, data);
 
index 336971d0870c149a0fa8cb7b5d166ffe4c4ffc20..165df9c27addb288290aae042c36b95b42746d15 100644 (file)
@@ -80,15 +80,17 @@ extern int libpthread_name_p (const char *name);
 /* Look up symbol from both symbol table and dynamic string table.  */
 
 extern CORE_ADDR gdb_bfd_lookup_symbol (bfd *abfd,
-                                       int (*match_sym) (asymbol *, void *),
-                                       void *data);
+                                       int (*match_sym) (const asymbol *,
+                                                         const void *),
+                                       const void *data);
 
 /* Look up symbol from symbol table.  */
 
 extern CORE_ADDR gdb_bfd_lookup_symbol_from_symtab (bfd *abfd,
-                                                   int (*match_sym) (asymbol *,
-                                                                     void *),
-                                                   void *data);
+                                                   int (*match_sym)
+                                                     (const asymbol *,
+                                                      const void *),
+                                                   const void *data);
 
 /* Enable or disable optional solib event breakpoints as appropriate.  */