Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Keith Seitz <keiths@redhat.com>
To: Fernando Nasser <fnasser@redhat.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFA/MI testsuite] Add pthreads tests
Date: Wed, 25 Sep 2002 09:08:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.44.0209250852030.1512-100000@valrhona.uglyboxes.com> (raw)
In-Reply-To: <3D91DA3C.8080505@redhat.com>

On Wed, 25 Sep 2002, Fernando Nasser wrote:

> Can you please fix this by mimicking gdb.threads?

It already does this. The real problem is that expect doesn't initialize 
expect_out when it starts up, so any accesses of this variable will cause 
a tcl error until any match is made. Dejagnu doesn't help by initializing 
it, either, so when suppressing files, it never gets set, and we have the 
behavior you observed. (This has always been a bug that I've worked around 
in my own mini-dejagnu implementations.)

I've committed the following workarounds for these problems, which will 
cause an ERROR (when the executable fails to load) and the tests will 
FAIL.

Keith

ChangeLog
2002-09-25  Keith Seitz  <keiths@redhat.com>

        * mi-pthreads.exp (get_mi_thread_list): Check if expect_out
        exists before using it.
        (check_mi_and_console_threads): Likewise.
        * gdb669.exp (get_mi_thread_list): Likewise.
        (check_mi_and_console_threads): Likewise.

Patch
Index: testsuite/gdb.mi/gdb669.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/gdb669.exp,v
retrieving revision 1.1
diff -p -r1.1 gdb669.exp
*** testsuite/gdb.mi/gdb669.exp	24 Sep 2002 19:36:06 -0000	1.1
--- testsuite/gdb.mi/gdb669.exp	25 Sep 2002 16:06:42 -0000
*************** proc get_mi_thread_list {name} {
*** 49,56 ****
      {\^done,thread-ids={(thread-id="[0-9]+"(,)?)+},number-of-threads="[0-9]+"} \
      "-thread_list_ids ($name)"
  
    set thread_list {}
!   if {![regexp {thread-ids=\{(thread-id="[0-9]+"(,)?)*\}} $expect_out(buffer) threads]} {
      fail "finding threads in MI output ($name)"
    } else {
      pass "finding threads in MI output ($name)"
--- 49,60 ----
      {\^done,thread-ids={(thread-id="[0-9]+"(,)?)+},number-of-threads="[0-9]+"} \
      "-thread_list_ids ($name)"
  
+   set output {}
+   if {[info exists expect_out(buffer)]} {
+     set output $expect_out(buffer)
+   }
    set thread_list {}
!   if {![regexp {thread-ids=\{(thread-id="[0-9]+"(,)?)*\}} $output threads]} {
      fail "finding threads in MI output ($name)"
    } else {
      pass "finding threads in MI output ($name)"
*************** proc check_mi_and_console_threads {name}
*** 77,83 ****
    mi_gdb_test "-thread-list-ids" \
      {\^done,thread-ids={(thread-id="[0-9]+"(,)*)+},number-of-threads="[0-9]+"} \
      "-thread-list-ids ($name)"
!   set mi_output $expect_out(buffer)
  
    # GDB will return a list of thread ids and some more info:
    #
--- 81,90 ----
    mi_gdb_test "-thread-list-ids" \
      {\^done,thread-ids={(thread-id="[0-9]+"(,)*)+},number-of-threads="[0-9]+"} \
      "-thread-list-ids ($name)"
!   set mi_output {}
!   if {[info exists expect_out(buffer)]} {
!     set mi_output $expect_out(buffer)
!   }
  
    # GDB will return a list of thread ids and some more info:
    #
*************** proc check_mi_and_console_threads {name}
*** 91,97 ****
    mi_gdb_test "info threads" \
      {.*(~".*"[\r\n]*)+.*} \
      "info threads ($name)"
!   set console_output $expect_out(buffer)
  
    # Make a list of all known threads to console (gdb's thread IDs)
    set console_thread_list {}
--- 98,107 ----
    mi_gdb_test "info threads" \
      {.*(~".*"[\r\n]*)+.*} \
      "info threads ($name)"
!   set console_output {}
!   if {[info exists expect_out(buffer)]} {
!     set console_output $expect_out(buffer)
!   }
  
    # Make a list of all known threads to console (gdb's thread IDs)
    set console_thread_list {}
Index: testsuite/gdb.mi/mi-pthreads.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-pthreads.exp,v
retrieving revision 1.2
diff -p -r1.2 mi-pthreads.exp
*** testsuite/gdb.mi/mi-pthreads.exp	24 Sep 2002 19:36:06 -0000	1.2
--- testsuite/gdb.mi/mi-pthreads.exp	25 Sep 2002 16:06:51 -0000
*************** proc get_mi_thread_list {name} {
*** 52,59 ****
      {\^done,thread-ids={(thread-id="[0-9]+"(,)?)+},number-of-threads="[0-9]+"} \
      "-thread_list_ids ($name)"
  
    set thread_list {}
!   if {![regexp {thread-ids=\{(thread-id="[0-9]+"(,)?)*\}} $expect_out(buffer) threads]} {
      fail "finding threads in MI output ($name)"
    } else {
      pass "finding threads in MI output ($name)"
--- 52,64 ----
      {\^done,thread-ids={(thread-id="[0-9]+"(,)?)+},number-of-threads="[0-9]+"} \
      "-thread_list_ids ($name)"
  
+   set output {}
+   if {[info exists expect_out(buffer)]} {
+     set output $expect_out(buffer)
+   }
+ 
    set thread_list {}
!   if {![regexp {thread-ids=\{(thread-id="[0-9]+"(,)?)*\}} $output threads]} {
      fail "finding threads in MI output ($name)"
    } else {
      pass "finding threads in MI output ($name)"
*************** proc check_mi_and_console_threads {name}
*** 80,86 ****
    mi_gdb_test "-thread-list-ids" \
      {\^done,thread-ids={(thread-id="[0-9]+"(,)*)+},number-of-threads="[0-9]+"} \
      "-thread-list-ids ($name)"
!   set mi_output $expect_out(buffer)
  
    # GDB will return a list of thread ids and some more info:
    #
--- 85,94 ----
    mi_gdb_test "-thread-list-ids" \
      {\^done,thread-ids={(thread-id="[0-9]+"(,)*)+},number-of-threads="[0-9]+"} \
      "-thread-list-ids ($name)"
!   set mi_output {}
!   if {[info exists expect_out(buffer)]} {
!     set mi_output $expect_out(buffer)
!   }
  
    # GDB will return a list of thread ids and some more info:
    #
*************** proc check_mi_and_console_threads {name}
*** 94,100 ****
    mi_gdb_test "info threads" \
      {.*(~".*"[\r\n]*)+.*} \
      "info threads ($name)"
!   set console_output $expect_out(buffer)
  
    # Make a list of all known threads to console (gdb's thread IDs)
    set console_thread_list {}
--- 102,111 ----
    mi_gdb_test "info threads" \
      {.*(~".*"[\r\n]*)+.*} \
      "info threads ($name)"
!   set console_output {}
!   if {[info exists $expect_out(buffer)]} {
!     set console_output $expect_out(buffer)
!   }
  
    # Make a list of all known threads to console (gdb's thread IDs)
    set console_thread_list {}


  reply	other threads:[~2002-09-25 16:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-10 16:15 Keith Seitz
2002-09-15 12:18 ` Elena Zannoni
2002-09-16  9:21   ` Keith Seitz
2002-09-24 12:20     ` Elena Zannoni
2002-09-24 12:36       ` Keith Seitz
2002-09-25  8:46         ` Fernando Nasser
2002-09-25  9:08           ` Keith Seitz [this message]
2002-09-16  7:30 ` Fernando Nasser

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.LNX.4.44.0209250852030.1512-100000@valrhona.uglyboxes.com \
    --to=keiths@redhat.com \
    --cc=fnasser@redhat.com \
    --cc=gdb-patches@sources.redhat.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