OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-6.8/] [gdb/] [testsuite/] [gdb.threads/] [thread-specific.exp] - Blame information for rev 840

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 24 jeremybenn
# Copyright 2004, 2007, 2008 Free Software Foundation, Inc.
2
 
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 3 of the License, or
6
# (at your option) any later version.
7
#
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
# GNU General Public License for more details.
12
#
13
# You should have received a copy of the GNU General Public License
14
# along with this program.  If not, see .
15
 
16
# Please email any bugs, comments, and/or additions to this file to:
17
# bug-gdb@prep.ai.mit.edu
18
 
19
# This file was written by Daniel Jacobowitz .
20
# It tests that the correct breakpoint is reported when we hit a
21
# thread-specific breakpoint inserted for several threads.
22
 
23
if $tracelevel then {
24
        strace $tracelevel
25
}
26
 
27
set prms_id 0
28
set bug_id 0
29
 
30
set testfile "thread-specific"
31
set srcfile ${testfile}.c
32
set binfile ${objdir}/${subdir}/${testfile}
33
 
34
if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } {
35
    return -1
36
}
37
 
38
# Return a list of the valid thread IDs, with the initial thread first.
39
proc get_thread_list { } {
40
  global gdb_prompt
41
  global expect_out
42
 
43
  set thr_list ""
44
 
45
  gdb_test_multiple "info threads" "get threads list" {
46
    -re "info threads\r\n" {
47
      exp_continue
48
    }
49
    -re "^\\*  *(\[0-9\]*) Thread \[^\n\]*main\[^\n\]*\n" {
50
      set thr_list "$expect_out(1,string) $thr_list"
51
      exp_continue
52
    }
53
    -re "^  *(\[0-9\]*) Thread \[^\n\]*\n" {
54
      lappend thr_list $expect_out(1,string)
55
      exp_continue
56
    }
57
    -re ".*$gdb_prompt $" {
58
      if { [llength $thr_list] != 0 } {
59
        pass "get threads list"
60
      } else {
61
        fail "get threads list (no threads)"
62
      }
63
    }
64
  }
65
 
66
  return $thr_list
67
}
68
 
69
# Start with a fresh gdb.
70
 
71
gdb_exit
72
gdb_start
73
gdb_reinitialize_dir $srcdir/$subdir
74
 
75
gdb_load ${binfile}
76
 
77
gdb_test "set print sevenbit-strings" ""
78
gdb_test "set width 0" ""
79
 
80
runto_main
81
 
82
gdb_breakpoint [gdb_get_line_number "thread-specific.exp: last thread start"]
83
gdb_continue_to_breakpoint "all threads started"
84
 
85
set line [gdb_get_line_number "thread-specific.exp: thread loop"]
86
set threads [get_thread_list]
87
 
88
if {[llength $threads] == 0} {
89
  # We have already issued a FAIL above.
90
  return 1
91
}
92
 
93
gdb_test_multiple "break $line thread [lindex $threads 0]" \
94
  "breakpoint $line main thread" {
95
    -re "Breakpoint (\[0-9\]*) at.* file .*$srcfile, line.*$gdb_prompt $" {
96
      set main_breakpoint $expect_out(1,string)
97
      pass "breakpoint $line main thread"
98
    }
99
}
100
 
101
foreach thread [lrange $threads 1 end] {
102
  gdb_breakpoint "$line thread $thread"
103
}
104
 
105
gdb_test_multiple "continue" "continue to thread-specific breakpoint" {
106
        -re "Breakpoint $main_breakpoint, .* at .*\r\n$gdb_prompt $" {
107
            fail "continue to thread-specific breakpoint (wrong breakpoint)"
108
        }
109
        -re "Breakpoint .* at .*\r\n$gdb_prompt $" {
110
            pass "continue to thread-specific breakpoint"
111
        }
112
}
113
 
114
return 0

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.