From a0bcdaa75e9fbabdf4e1654e4aba5237c8360989 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Wed, 13 Mar 2013 16:45:11 +0000 Subject: More invalid pointer to pointer conversions. As a follow up to: http://sourceware.org/ml/gdb-patches/2013-03/msg00449.html In a nutshell, casts between 'char **' <-> 'unsigned char **' and 'char **' <-> 'const char **' are invalid. I grepped for "\*\*) &" and found these. There's another one in demangle.c, but I've split fixing that one to a separate patch. I think the ada_decode_symbol change is perhaps the one that could be surprising. The function's description has this comment, which makes things much clearer: The GSYMBOL parameter is "mutable" in the C++ sense: logically const, but nevertheless modified to a semantically equivalent form when a decoded name is cached in it. */ const char * ada_decode_symbol (const struct general_symbol_info *gsymbol) With that out of the way, I think the patch ends up being pretty obvious. Tested on x86_64 Fedora 17. gdb/ 2013-03-13 Pedro Alves * ada-lang.c (ada_decode_symbol): Cast away constness of GSYMBOL rather than casting 'const char * const *' to 'const char **'. * ada-lex.l (processInt): Make "trailer" local const. Remove 'const char **' cast. * arm-linux-tdep.c (arm_stap_parse_special_token): Add 'char *' locals, and use those as strtol output pointer, instead than doing invalid casts to from 'const char **' to 'char **'. (_initialize_demangle): Remove cast. * i386-tdep.c (i386_stap_parse_special_token): : Add 'char *' locals, and use those as strtol output pointer, instead than doing invalid casts to from 'const char **' to 'char **'. * solib-dsbt.c (dsbt_get_initial_loadmaps): Remove 'gdb_byte**' casts. * stap-probe.c (stap_parse_register_operand) (stap_parse_single_operand): Likewise. --- gdb/solib-dsbt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gdb/solib-dsbt.c') diff --git a/gdb/solib-dsbt.c b/gdb/solib-dsbt.c index c41326b..ea2acd1 100644 --- a/gdb/solib-dsbt.c +++ b/gdb/solib-dsbt.c @@ -298,7 +298,7 @@ dsbt_get_initial_loadmaps (void) struct dsbt_info *info = get_dsbt_info (); if (0 >= target_read_alloc (¤t_target, TARGET_OBJECT_FDPIC, - "exec", (gdb_byte**) &buf)) + "exec", &buf)) { info->exec_loadmap = NULL; error (_("Error reading DSBT exec loadmap")); @@ -308,7 +308,7 @@ dsbt_get_initial_loadmaps (void) dsbt_print_loadmap (info->exec_loadmap); if (0 >= target_read_alloc (¤t_target, TARGET_OBJECT_FDPIC, - "interp", (gdb_byte**)&buf)) + "interp", &buf)) { info->interp_loadmap = NULL; error (_("Error reading DSBT interp loadmap")); -- cgit v1.1