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: [PATCH 2/3] Add testcases for display function


>     add testcases to test display under different conditions

Same kind of procedural issues as before, so I'm not going to comment
on those again.

> --- a/gdb/testsuite/gdb.base/display.c
> +++ b/gdb/testsuite/gdb.base/display.c
> @@ -4,6 +4,11 @@
>  #define LOOP 10
>  
>  int sum = 0;
> +int int_array[2]={0,1};

The formatting does not follow the GCS:
  - spaces around binary operators;
  - space after comma.
Thus:

int int_array[2] = {0, 1};

> +struct {
> +	char name;
> +	int age;
> +} human;

GCS issues:
  - the opening curly braces should be on the next line. 
  - the indentation level should be 2 characters.
Thus:

struct
  {
    char name;
    int age;
  } human;

> +set bp_location [gdb_get_line_number "set breakpoint 1 here"]
> +send_gdb "break $bp_location\n"
> +send_gdb "run\n"

Do not use send_gdb unless you absolutely have no other choice.
Take a look at the gdb testsuite cookbook for how to insert breakpoints
and run to them.

Also, this might no longer become relevant, but it's better to never
test the "run" command directly, since there are targets where this
is not the appropriate thing to do (Eg: when using gdbserver, we do
"set target remote ..." followed by "continue" instead).

But why not enhance display.exp instead of creating a new one?

-- 
Joel


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