summaryrefslogtreecommitdiff
path: root/gdb/arm-linux-tdep.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2013-03-13 16:45:06 +0000
committerPedro Alves <palves@redhat.com>2013-03-13 16:45:06 +0000
commit243a8189577dfee5d11924750bfe0a2024963e88 (patch)
treee13a4312869a8909143526e63f05689c912f935c /gdb/arm-linux-tdep.c
parent98486eff86243307ae5c2c5beb6494edd0bd2219 (diff)
downloadgdb-243a8189577dfee5d11924750bfe0a2024963e88.tar.gz
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 <palves@redhat.com> * 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.
Diffstat (limited to 'gdb/arm-linux-tdep.c')
-rw-r--r--gdb/arm-linux-tdep.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c
index 278a665c3b5..953e52542e9 100644
--- a/gdb/arm-linux-tdep.c
+++ b/gdb/arm-linux-tdep.c
@@ -1088,6 +1088,7 @@ arm_stap_parse_special_token (struct gdbarch *gdbarch,
{
/* Temporary holder for lookahead. */
const char *tmp = p->arg;
+ char *endp;
/* Used to save the register name. */
const char *start;
char *regname;
@@ -1140,7 +1141,8 @@ arm_stap_parse_special_token (struct gdbarch *gdbarch,
got_minus = 1;
}
- displacement = strtol (tmp, (char **) &tmp, 10);
+ displacement = strtol (tmp, &endp, 10);
+ tmp = endp;
/* Skipping last `]'. */
if (*tmp++ != ']')