This is the mail archive of the gdb-patches@sources.redhat.com 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: [RFC] new GDB server testcase


On Wed, May 04, 2005 at 01:36:48PM -0500, Manoj Iyer wrote:
> -gdb_breakpoint main
> -gdb_test "continue" "Breakpoint.* main .*" "continue to main"
> +gdb_test "br main" "Breakpoint 1.*at.* file .*$srcfile, line \[0-9\]+.*"
> +
> +gdb_test "continue" ".*Continuing\\..*Breakpoint \[0-9\]+, main.*at .*$srcfile:\[0-9\].*"

Why not use gdb_breakpoint?  Is it because you want to test that the
breakpoint was placed in the right file?  If so, you need to use a
regular expression for the breakpoint number as below.  I'd rather just
use gdb_breakpoint though.

> +send_gdb "list \n"
> +gdb_expect {
> +        -re ".*main.*\{.*$gdb_prompt $" {
> +        pass "list commands can display source code" }
> +        timeout { fail "list command failed to display source code" }
> +}

Why not use gdb_test for this?

> +gdb_test "br function3" "Breakpoint 2.*at.* file .*$srcfile, line \[0-9\]+.*"
> +
> +gdb_test "continue" ".*Continuing\\..*Breakpoint \[0-9\]+, function3.*at .*$srcfile:\[0-9\].*"
> +
> +send_gdb "backtrace\n"
> +gdb_expect_list "backtrace" ".*$gdb_prompt $" {
> +    "#0.*function3.*at.*server.c:\[0-9\]+"
> +    "#1.*function2.*at.*server.c:\[0-9\]+"
> +    "#2.*function1.*at.*server.c:\[0-9\]+"
> +    "#3.*main.*at.*server.c:\[0-9\]+"
> +}

Try to avoid using send_gdb directly.  You can construct the pattern in
a variable and use gdb_test.

> +gdb_test "step" "function4.*at .*$srcfile:\[0-9\]+.*"
> +
> +gdb_test "step 3" ".*${decimal}.*y = x.* y;.*"

That's a lot of wildcards.  Can't you put a marker comment on the lines
you want to reach?

> +gdb_test "print x" ".*3.*"

Please be more precise.  "\$\[0-9\]* = 3" should be enough.

-- 
Daniel Jacobowitz
CodeSourcery, LLC


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