[PATCH 23/25] [GDBserver] Convert amd64-linux target descriptions
Pedro Alves
palves@redhat.com
Wed Jun 28 19:00:00 GMT 2017
On 06/12/2017 09:41 AM, Yao Qi wrote:
> +static const struct target_desc *amd64_tdescs[X86_TDESC_LAST] = { };
> +static const struct target_desc *x32_tdescs[X86_TDESC_LAST] = { };
> +
> +
> + if (is_x32)
> + tdesc = (struct target_desc **) &x32_tdescs[idx];
> + else
> + tdesc = (struct target_desc **) &amd64_tdescs[idx];
> +
> + if (*tdesc == NULL)
> + {
> + *tdesc = new target_desc ();
You can't cast away constness of really-const objects and
write to them. The compiler is free to place the array
in read-only storage. If this doesn't crash at run time,
it's sheer luck.
Thanks,
Pedro Alves
More information about the Gdb-patches
mailing list