From: Joel Brobecker <brobecker@adacore.com>
To: Thiago Jung Bauermann <bauerman@br.ibm.com>
Cc: Daniel Jacobowitz <drow@false.org>,
gdb-patches ml <gdb-patches@sourceware.org>
Subject: Re: [RFA] Add la_getstr member to language_defn
Date: Tue, 03 Feb 2009 00:23:00 -0000 [thread overview]
Message-ID: <20090203002336.GB3964@adacore.com> (raw)
In-Reply-To: <1230949603.8380.143.camel@localhost.localdomain>
> The patch doesn't apply anymore. This is the same patch, refreshed
> against HEAD as of Dec 28th. Ok?
Just a few comments and questions in addition to Tom's comments...
> + if ((TYPE_NFIELDS (type) == 1)
> + && TYPE_CODE (TYPE_FIELD_TYPE (type, 0)) == TYPE_CODE_RANGE)
The extra parens around "TYPE_NFIELDS (type) == 1" shouldn't be
necessary, right? In this case, it's pretty harmless, but a little
bit below, this really starts making it hard to read a condition...
> + if (((VALUE_LVAL (value) == not_lval)
> + || (VALUE_LVAL (value) == lval_internalvar)) && (fetchlimit != UINT_MAX))
Can this be formatted as follow:
if ((VALUE_LVAL (value) == not_lval
|| VALUE_LVAL (value) == lval_internalvar)
&& fetchlimit != UINT_MAX)
? (assuming my reading is correct!) The reason I like my suggestion
is because there are less parentheses, so it's easier to match them
without using my favorite editor; also, the formatting makes it clear
at which level the || and the && operators are.
> + if ((TYPE_CODE (element_type) != TYPE_CODE_INT)
> + && (TYPE_CODE (element_type) != TYPE_CODE_CHAR))
Same here.
> @@ -511,6 +626,7 @@ const struct language_defn minimal_language_defn =
> c_language_arch_info,
> default_print_array_index,
> default_pass_by_reference,
> + default_get_string,
> LANG_MAGIC
> };
I was wondering if it wouldn't be more useful to use the c_get_string
function as the default rather than the default_get_string stub.
What do you guys think? Granted, I know that there are cases for Ada
where this isn't going to be enough, but I also know that it's going
to handle some cases fine. I don't know how other languages such as
Fortran or Pascal encode their strings, but chances are that if we
call this function with a value whose type is an array of chars/ints
or a char/int pointer, the c_get_string value would probably work.
As for the Ada implementation, it's probably going to look like this:
if (value_type is char/int_array or char/int_pointer)
{
/* A string a-la-C: Call the C get_string routine... */
c_get_string (...);
return;
}
/* Ada-specific strings handled here. */
So setting the la_get_string method to c_get_string would be a good
starting point for Ada. The implementation is robust enough that
we'd get an error if the value type is not handled properly, which
is exactly what the default_get_string routine always does.
--
Joel
next prev parent reply other threads:[~2009-02-03 0:23 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-24 13:24 Thiago Jung Bauermann
2008-11-24 13:32 ` Daniel Jacobowitz
2008-11-24 14:59 ` Thiago Jung Bauermann
2008-11-24 16:19 ` Daniel Jacobowitz
2008-11-24 20:22 ` Thiago Jung Bauermann
2008-11-25 2:16 ` Daniel Jacobowitz
2008-11-25 8:53 ` Thiago Jung Bauermann
2009-01-03 2:27 ` Thiago Jung Bauermann
2009-02-02 18:42 ` Tom Tromey
2009-02-03 12:51 ` Thiago Jung Bauermann
2009-02-03 17:44 ` Tom Tromey
2009-02-04 12:37 ` Thiago Jung Bauermann
2009-02-04 19:19 ` Tom Tromey
2009-02-04 22:26 ` Thiago Jung Bauermann
2009-02-05 0:55 ` Tom Tromey
2009-02-05 12:21 ` Thiago Jung Bauermann
2009-02-05 16:01 ` Pierre Muller
2009-02-05 16:30 ` Thiago Jung Bauermann
2009-02-05 16:46 ` Tom Tromey
2009-02-05 15:55 ` Tom Tromey
2009-02-05 16:07 ` Pierre Muller
2009-02-05 16:33 ` Thiago Jung Bauermann
2009-02-05 16:46 ` Tom Tromey
2009-02-03 0:23 ` Joel Brobecker [this message]
2009-02-03 13:02 ` Thiago Jung Bauermann
2009-02-03 17:01 ` Joel Brobecker
2009-02-03 17:40 ` Tom Tromey
2009-02-05 17:01 ` Thiago Jung Bauermann
2009-02-05 23:51 ` Joel Brobecker
2008-11-24 20:03 ` Tom Tromey
2008-11-24 21:19 ` Thiago Jung Bauermann
2008-11-25 0:55 ` Tom Tromey
2008-11-25 11:27 ` Thiago Jung Bauermann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090203002336.GB3964@adacore.com \
--to=brobecker@adacore.com \
--cc=bauerman@br.ibm.com \
--cc=drow@false.org \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox