This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Force array coercion in c_get_string


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]