summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2015-10-13 12:40:01 -0400
committerSimon Marchi <simon.marchi@ericsson.com>2015-10-13 12:42:35 -0400
commit3953f15ce4b4154e9fd7951424fedac0170ab59c (patch)
tree8f28ff7aa2ad9fbed7ad99a3372c8b85ecf34996
parent01f573ad8aa539f972e2fef8a10ef290e042e24c (diff)
downloadbinutils-gdb-3953f15ce4b4154e9fd7951424fedac0170ab59c.tar.gz
Constify arguments of gdb_bfd_lookup_symbol and related functions
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.
-rw-r--r--gdb/ChangeLog11
-rw-r--r--gdb/solib-dsbt.c2
-rw-r--r--gdb/solib-frv.c2
-rw-r--r--gdb/solib-svr4.c4
-rw-r--r--gdb/solib.c14
-rw-r--r--gdb/solib.h12
6 files changed, 30 insertions, 15 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e77f1bd9493..e96aa7c7ca2 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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,
diff --git a/gdb/solib-dsbt.c b/gdb/solib-dsbt.c
index 3218bbec635..d01f9db29a7 100644
--- a/gdb/solib-dsbt.c
+++ b/gdb/solib-dsbt.c
@@ -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);
}
diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c
index 922ee36a88a..451bbdfe232 100644
--- a/gdb/solib-frv.c
+++ b/gdb/solib-frv.c
@@ -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);
}
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index 55b8f556677..2dc1692ab1b 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -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;
}
diff --git a/gdb/solib.c b/gdb/solib.c
index 9a6e7dee458..ca2c9ab89c2 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -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);
diff --git a/gdb/solib.h b/gdb/solib.h
index 336971d0870..165df9c27ad 100644
--- a/gdb/solib.h
+++ b/gdb/solib.h
@@ -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. */