Re: [RFC] new GDB server testcase

Daniel Jacobowitz
2005-05-04T14:43:58Z

On Wed, May 04, 2005 at 09:24:20AM -0500, Manoj Iyer wrote:
>
> I wrote a testcase for testing basic gdbserver functionality over TCP
> connection. I will add more cases like step, print, etc once the testcase
> is approved.

Thanks for doing this.

Can you find a better name than "basictest.exp"? Is there a reason not
to add these basic tests to server-run.exp?

> /* File: test basic remote debug functionality through TCP connection. */
> /* Author: Manoj Iyer <manjo@austin.ibm.com> */

This needs a copyright notice.

> #include <stdio.h>
> #include <stdlib.h>

Why are you using stdio? We have no easy way to get at the program's
output.

>
> main()
> {
> printf("hello gdb\n");
> function1();
> }

That's not valid C, though many compilers will accept it. "int main"
and "return 0" please.

>
> ======================================================================
>
> ======================= basictest.exp ===============================

Please use server-run.exp as a template instead of whatever you were
using. For instance, use skip_gdbserver_tests, and don't use
gdb_suppress_entire_file.

> gdb_exit
> global gdbport
>
> set ret [gdbserver_spawn $binfile ""]
> set gdbport [lindex $ret 1]
>
> gdb_start
>
> send_gdb "file $binfile \n "
>
> gdb_target_cmd "remote" $gdbport

... and don't duplicate any of that. gdbserver_load. I went to a lot
of trouble to write the infrastructure, so please use it :-)