Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Keith Seitz <keiths@redhat.com>
To: Michael Elizabeth Chastain <mec@shout.net>
Cc: <gdb@sources.redhat.com>
Subject: Re: how to call gdb_test "" ... ?
Date: Mon, 18 Feb 2002 15:32:00 -0000	[thread overview]
Message-ID: <Pine.GSO.4.33.0202181513420.24764-100000@makita.cygnus.com> (raw)
In-Reply-To: <200202182237.g1IMbH122114@duracef.shout.net>

On Mon, 18 Feb 2002, Michael Elizabeth Chastain wrote:

> That is to say, I want to send a "list" command, and then send some
> empty commands and look at the results as usual.
>
> gdb_test does not work with an argument of "".

I'll go out on a limb here and say offer that gdb_test be modified:

<gripe>
1) To make it legible:

  proc gdb_test { args } {
     # snip
     set command [lindex $args 0]
     set pattern [lindex $args 1]

     # snip
     set result -1
     set string "${command}\n"
     if { $command != "" } {
         while { "$string" != "" } {
           set foo [string first "\n" "$string"]
           set len [string length "$string"]
           if { $foo < [expr $len - 1] } {
              if [send_gdb "$str"] != "" } {
                #snip
              }
              # snip
           }
          set string [string range "$string" [expr $foo + 1] end
     }
     # snip

Why is this done???? Why not just:

     proc gdb_test {command pattern args} {
       # snip
       set cmd "$command\n"
       foreach cmd [split $command \n] {
         if {$cmd != ""} {
           if {[send_gdb $cmd] != ""} {
             #snip
           }
         }
       # snip

I don't know. Whomever wrote it did not understand tcl at all.
</gripe>

2) To allow empty commands, i.e., skip the send, do the expect

Actually, I don't see from reading the code for gdb_test why "" would be
disallowed. Is it giving you some sort of error?

Ok, off my soapbox now.
Keith



  parent reply	other threads:[~2002-02-18 23:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-18 14:37 Michael Elizabeth Chastain
2002-02-18 15:16 ` Daniel Jacobowitz
2002-02-18 15:32 ` Keith Seitz [this message]
2002-02-18 15:33 Michael Elizabeth Chastain
2002-02-18 16:19 ` Daniel Jacobowitz
2002-02-18 15:46 Michael Elizabeth Chastain
2002-02-18 16:28 Michael Elizabeth Chastain

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=Pine.GSO.4.33.0202181513420.24764-100000@makita.cygnus.com \
    --to=keiths@redhat.com \
    --cc=gdb@sources.redhat.com \
    --cc=mec@shout.net \
    /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