This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Force array coercion in c_get_string
- From: Pedro Alves <palves at redhat dot com>
- To: Tom Tromey <tromey at adacore dot com>, gdb-patches at sourceware dot org
- Date: Thu, 25 Apr 2019 19:32:36 +0100
- Subject: Re: [PATCH] Force array coercion in c_get_string
- References: <20190425181740.18062-1-tromey@adacore.com>
On 4/25/19 7:17 PM, Tom Tromey wrote:
> A user here noticed that the Python Value.string method did not work
> for Ada arrays. I tracked this down to an oddity in value_as_address
> -- namely, it calls coerce_array, but that function will not force
> array coercion when the language has c_style_arrays=false, as Ada
> does.
>
> This patch fixes the problem by forcing array coercion in
> c_get_string. Changing either value_as_address or coerce_array seemed
> iffy to me.
So with the patch, we coerce the array to inferior memory, in order
to read its contents back from the inferior? Is that right?
Why not skip the detour and save the memory allocation in the inferior?
If this patch is reacheable with core or exec file debugging, your patch
makes gdb error out, because you can't allocate inferior memory in those
cases, of course. Not sure whether that's relevant here, but it might be.
Thanks,
Pedro Alves