This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v3 2/4] Add testcases to display.exp
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Fei Jie <feij dot fnst at cn dot fujitsu dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Sun, 6 Dec 2015 15:00:13 +0100
- Subject: Re: [PATCH v3 2/4] Add testcases to display.exp
- Authentication-results: sourceware.org; auth=none
- References: <1447142188-20759-1-git-send-email-feij dot fnst at cn dot fujitsu dot com> <1447142188-20759-3-git-send-email-feij dot fnst at cn dot fujitsu dot com>
On Tue, Nov 10, 2015 at 03:56:26PM +0800, Fei Jie wrote:
> add testcases to display different types of data and variables
> *display/d/u/o/t/a/c
> *display array and structure
Same as for patch #1, no identation and capital 'A' for "Add".
Also, would you mind adding a space after the '*' for each bullet point?
I think this is going to make the revision log more readable.
> gdb/testsuite/ChangeLog:
>
> * gdb.base/display.c: Add varaible types.
typo: "varaible" -> "variable". But the sentence is malformed, since
it says you're adding types, which is not the case; you are adding
varaibles. I would be more precise, to help readers of the
ChangeLog entry, and say:
* gdb.base/display.c: Add integer array varaible. Add struct
variable.
> * gdb.base/display.exp: Add testcases to test display.
"Add additional tests of the display command."
> ---
> gdb/testsuite/gdb.base/display.c | 6 ++++++
> gdb/testsuite/gdb.base/display.exp | 17 ++++++++++++++---
> 2 files changed, 20 insertions(+), 3 deletions(-)
>
> diff --git a/gdb/testsuite/gdb.base/display.c b/gdb/testsuite/gdb.base/display.c
> index cd833e2..2ade4d7 100644
> --- a/gdb/testsuite/gdb.base/display.c
> +++ b/gdb/testsuite/gdb.base/display.c
> @@ -4,6 +4,12 @@
> #define LOOP 10
>
> int sum = 0;
> +int int_array[2] = {0, 1};
> +struct
> + {
> + char name;
> + int age;
> + } human;
The formatting does not conform to the GNU Coding Standards. It should
be:
struct
{
char name;
int age;
} human;
>
> /* Call to force a variable onto the stack so we can see its address. */
> void force_mem (int *arg) { }
> diff --git a/gdb/testsuite/gdb.base/display.exp b/gdb/testsuite/gdb.base/display.exp
> index 6e21d9e..8cbf875 100644
> --- a/gdb/testsuite/gdb.base/display.exp
> +++ b/gdb/testsuite/gdb.base/display.exp
> @@ -80,13 +80,24 @@ gdb_test "disp/x j" ".*2: /x j = 0x0.*" "display j"
> gdb_test "disp/i &k" ".*3: x/i &k(\r\n| ) $hex:.*" "display &k"
> gdb_test "disp/f f" ".*4: /f f = 3.1415*" "display/f f"
> gdb_test "disp/s &sum" ".*5: x/s &sum $hex.*sum.:.*" "display/s &sum"
> +gdb_test "disp/d f" "6: /d f = 3" "display/d f"
> +gdb_test "disp/u f" "7: /u f = 3" "display/u f"
> +gdb_test "disp/o f" "8: /o f = 03" "display/o f"
> +gdb_test "disp/t f" "9: /t f = 11" "display/t f"
> +gdb_test "disp/a f" "10: /a f = 0x3" "display/a f"
> +gdb_test "disp/c f" "11: /c f = 3\ \'\\\\003\'" "display/c f"
> +
> +gdb_test "disp int_array" \
> + "12: int_array = \\{0, 1\\}" "display array"
> +gdb_test "disp human" \
> + "13: human = {name = 0 '\\\\000', age = 0}" "display struct"
>
> # Hit the displays
> #
> -gdb_test "cont" ".*\[Ww\]atchpoint 3: sum.*\[1-9\]*: x/s &sum.*\[1-9\]*: /f f = 3.1415\r\n\[1-9\]*: x/i &k.*\r\n\[1-9\]*: /x j = 0x0\r\n\[1-9\]*: i = 0.*" "first disp"
> -gdb_test "cont" ".*\[Ww\]atchpoint 3: sum.*\[1-9\]*: x/s &sum.*\[1-9\]*: /f f = 4.1415\r\n\[1-9\]*: x/i &k.*\r\n\[1-9\]*: /x j = 0x0.*\[1-9\]*: i = 0.*" "second disp"
> +gdb_test "cont" ".*\[Ww\]atchpoint 3: sum.*\[1-9\]*: human.*\[1-9\]*: int_array.*\[1-9\]*: /c f = 3 \'\\\\003\'\r\n\[0-9\]*: /a f = 0x3\r\n\[1-9\]*: /t f = 11\r\n\[1-9\]*: /o f = 03\r\n\[1-9\]*: /u f = 3\r\n\[1-9\]*: /d f = 3\r\n\[1-9\]*: x/s &sum.*\[1-9\]*: /f f = 3.1415\r\n\[1-9\]*: x/i &k.*\r\n\[1-9\]*: /x j = 0x0\r\n\[1-9\]*: i = 0.*" "first disp"
> +gdb_test "cont" ".*\[Ww\]atchpoint 3: sum.*\[1-9\]*: human.*\[1-9\]*: int_array.*\[1-9\]*: /c f = 4 \'\\\\004\'\r\n\[0-9\]*: /a f = 0x4\r\n\[1-9\]*: /t f = 100\r\n\[1-9\]*: /o f = 04\r\n\[1-9\]*: /u f = 4\r\n\[1-9\]*: /d f = 4\r\n\[1-9\]*: x/s &sum.*\[1-9\]*: /f f = 4.1415\r\n\[1-9\]*: x/i &k.*\r\n\[1-9\]*: /x j = 0x0\r\n\[1-9\]*: i = 0.*" "second disp"
Do you think the tests above could be made more readable by using
the multi_line function?
--
Joel