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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-7.1/] [gdb/] [testsuite/] [gdb.threads/] [thread-specific.exp] - Blame information for rev 318

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 227 jeremybenn
# Copyright 2004, 2007, 2008, 2009, 2010 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
# This file was written by Daniel Jacobowitz .
17
# It tests that the correct breakpoint is reported when we hit a
18
# thread-specific breakpoint inserted for several threads.
19
 
20
if $tracelevel then {
21
        strace $tracelevel
22
}
23
 
24
set prms_id 0
25
set bug_id 0
26
 
27
set testfile "thread-specific"
28
set srcfile ${testfile}.c
29
set binfile ${objdir}/${subdir}/${testfile}
30
 
31
if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } {
32
    return -1
33
}
34
 
35
# Return a list of the valid thread IDs, with the initial thread first.
36
proc get_thread_list { } {
37
  global gdb_prompt
38
  global expect_out
39
 
40
  set thr_list ""
41
 
42
  gdb_test_multiple "info threads" "get threads list" {
43
    -re "info threads\r\n" {
44
      exp_continue
45
    }
46
    -re "New Thread \[^\n\]*\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.