This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] Add la_getstr member to language_defn
- From: Thiago Jung Bauermann <bauerman at br dot ibm dot com>
- To: tromey at redhat dot com
- Cc: Daniel Jacobowitz <drow at false dot org>, gdb-patches ml <gdb-patches at sourceware dot org>
- Date: Tue, 03 Feb 2009 10:51:41 -0200
- Subject: Re: [RFA] Add la_getstr member to language_defn
- References: <1227417278.28256.183.camel@localhost.localdomain> <20081123161013.GA15069@caradoc.them.org> <1227490821.8533.25.camel@hotblack.bauerhaus> <20081124022858.GA19331@caradoc.them.org> <1227551659.28256.225.camel@localhost.localdomain> <20081124202146.GA1991@caradoc.them.org> <1227564549.28256.248.camel@localhost.localdomain> <1230949603.8380.143.camel@localhost.localdomain> <m3d4e0ptoq.fsf@fleche.redhat.com>
El lun, 02-02-2009 a las 11:41 -0700, Tom Tromey escribiÃ:
> >>>>> "Thiago" == Thiago Jung Bauermann <bauerman@br.ibm.com> writes:
>
> [ la_getstr ]
> Thiago> The patch doesn't apply anymore. This is the same patch, refreshed
> Thiago> against HEAD as of Dec 28th.
>
> Thiago> + Return 0 on success, errno on failure. */
> Thiago> +
> Thiago> +static int
> Thiago> +c_get_string (struct value *value, gdb_byte **buffer, int *length,
> Thiago> + const char **charset)
>
> The return value here is a bit funny. For some errors this function
> calls error, but for others it returns the result of read_string.
>
> When would we want the latter behavior? I think perhaps la_getstr
> should simply have 'void' type and then call error if read_string
> returns an error.
The function throws an exception when it can't even start to read a
string, and returns an error when it may have already read something,
but hit an error halfway through.
> What do you think?
I don't have a strong preference. The function could always throw an
exception on error, and the caller would then check LENGTH to see if
something was read. I can change it to do so if you prefer it that way.
--
[]'s
Thiago Jung Bauermann
IBM Linux Technology Center