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: [RFA] Add la_getstr member to language_defn


>>>>> "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


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