Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Manoj Iyer <manjo@austin.ibm.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFC] new GDB server testcase
Date: Wed, 04 May 2005 18:46:00 -0000	[thread overview]
Message-ID: <20050504184620.GA19639@nevyn.them.org> (raw)
In-Reply-To: <Pine.LNX.4.58.0505041329440.30511@lazy>

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


  reply	other threads:[~2005-05-04 18:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-04 14:27 Manoj Iyer
2005-05-04 14:43 ` Daniel Jacobowitz
2005-05-04 18:39   ` Manoj Iyer
2005-05-04 18:46     ` Daniel Jacobowitz [this message]
2005-05-04 21:59       ` Manoj Iyer
2005-05-04 22:07         ` Daniel Jacobowitz
2005-05-05 16:23           ` Manoj Iyer
2005-05-05 16:27             ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050504184620.GA19639@nevyn.them.org \
    --to=drow@false.org \
    --cc=gdb-patches@sources.redhat.com \
    --cc=manjo@austin.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox