This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] Make symbol completion language-specific
- From: Daniel Jacobowitz <drow at false dot org>
- To: Joel Brobecker <brobecker at adacore dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Tue, 29 Jan 2008 12:28:00 -0500
- Subject: Re: [RFA] Make symbol completion language-specific
- References: <20071228122825.GC24450@adacore.com>
On Fri, Dec 28, 2007 at 04:28:25AM -0800, Joel Brobecker wrote:
> 1. How does someone verify that a GDB command does not return
> any output. Do we really have to do it "manually" (using
> gdb_send et al)? Right now, there is a hole in my testcase
> regarding this, and I need to fix it before I commit it.
Pretty much, though I think you could do it with gdb_test_multiple;
see how lib/mi-support.exp does it. MI tests are anchored by default.
There may be more trouble doing it for the CLI, though, because
readline puts extra stuff in the output sometimes.
> 2. I was getting tired of writing expected output regexps that
> were completely unreadable mostly because the output was matching
> more than one line that ended up concatenated inside the same
> string. So I wrote the following little helper function:
>
> proc multi_line { args } {
> return [join $args "\[\r\n\]*"]
> }
>
> This function allows me to do something like this:
>
> gdb_test "print variable" \
> [multi_line "first_line" \
> "second_line" \
> "last_line" ] \
> "print big variable"
>
> I think that this is far easier to read than:
>
> gdb_test "print variable" \
> "first_line${eol}second_line${eol}last_line"
> "print big variable"
Also see gdb_expect_list, which is similar. I think that the way
you've written it lends to things being too far indented, which will
be hard to read...
> Index: ada-lang.c
> ===================================================================
> --- ada-lang.c (revision 12)
> +++ ada-lang.c (revision 13)
> @@ -68,6 +68,17 @@
> #define TRUNCATION_TOWARDS_ZERO ((-5 / 2) == -2)
> #endif
>
> +/* A structure that contains a vector of strings.
> + The main purpose of this type is to group the vector and its
> + associated parameters in one structure. This makes it easier
> + to handle and pass around. */
> +
> +struct string_vector
> +{
> + char **array; /* The vector itself. */
> + int index; /* Index of the next available element in the array. */
> + size_t size; /* The number of entries allocated in the array. */
> +};
We have a generic VEC nowadays.
You left the "should be language specific" FIXME :-)
And a general comment, I'm not thrilled at the amount of generic
symbol table code had to be duplicated in the Ada-specific files. But
that's the status quo for ada-lang.c, anyway.
I have no objections, despite the above whining.
--
Daniel Jacobowitz
CodeSourcery