Re: [RFA] Add la_getstr member to language_defn

Tom Tromey
2009-02-05T15:55:02Z

>>>>> "Thiago" == Thiago Jung Bauermann <bauerman@br.ibm.com> writes:

Thiago> Right. Here's the new version. It also uses c_get_string for Ada and
Thiago> minimal...

Last night I thought of something else...

Thiago> + Assumes strings are terminated by a null character.
[...]
Thiago> +void
Thiago> +c_get_string (struct value *value, gdb_byte **buffer, int *length,
Thiago> + const char **charset)

My understanding is that the contract for la_getstr says that the
resulting string will be zero-terminated. But if that is the case...

Thiago> +read_string (CORE_ADDR addr, int len, int width, unsigned int fetchlimit,
[...]
Thiago> + { /* Length of string is really 0! */
Thiago> + /* We always allocate *buffer. */
Thiago> + *buffer = bufptr = xmalloc (1);

... I think this code ought to allocate a buffer of WIDTH bytes, and
set them all to 0.

Tom