]> git.pld-linux.org Git - packages/gdb.git/blob - gdb-core-thread-internalerr-1of3.patch
- up to 7.3.1
[packages/gdb.git] / gdb-core-thread-internalerr-1of3.patch
1 http://sourceware.org/ml/gdb-patches/2011-02/msg00679.html
2 Subject: Re: [patch 1/3] Code cleanup: gdb.threads/gcore-thread.exp
3
4 On Thu, 24 Feb 2011 08:20:09 +0100, Joel Brobecker wrote:
5 > Just a thought: Do we really need to worry about restoring
6 > the timeout at the end of the testcase, given that this is
7 > automatically done at the start of each testcase (see gdb.exp:
8 > gdb_init)?
9
10 I see now:
11         Re: [RFA/testsuite] Reset the timeout duration at the start of each testcase.
12         http://sourceware.org/ml/gdb-patches/2010-02/msg00202.html
13         commit 501c57da40fd27c8036a5fc995f750b0559272ad
14
15 Patch updated.
16
17
18 Thanks,
19 Jan
20
21
22 gdb/testsuite/
23 2011-02-24  Jan Kratochvil  <jan.kratochvil@redhat.com>
24
25         * gdb.threads/gcore-thread.exp ($testfile): Match it the .exp
26         filename.
27         ($srcfile): Preserve the original value.
28         ($testfile): Match it the .exp filename.
29         ($corefile): New variable.  Substitute it around.
30         Use clean_restart.
31         ($prev_timeout): Remove.
32         (load_core): Move core loading into this proc.
33         Fix restore of $timeout if load_core fails.
34
35 --- a/gdb/testsuite/gdb.threads/gcore-thread.exp
36 +++ b/gdb/testsuite/gdb.threads/gcore-thread.exp
37 @@ -21,11 +21,11 @@ if $tracelevel then {
38         strace $tracelevel
39  }
40  
41 -
42  # Single-threaded test case
43 -set testfile "pthreads"
44 -set srcfile  ${testfile}.c
45 -set binfile  ${objdir}/${subdir}/gcore-${testfile}
46 +set testfile "gcore-thread"
47 +set srcfile  pthreads.c
48 +set binfile  ${objdir}/${subdir}/${testfile}
49 +set corefile ${objdir}/${subdir}/${testfile}.test
50  
51  if [istarget "*-*-linux"] then {
52      set target_cflags "-D_MIT_POSIX_THREADS"
53 @@ -41,10 +41,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
54  
55  # Start with a fresh gdb.
56  
57 -gdb_exit
58 -gdb_start
59 -gdb_reinitialize_dir $srcdir/$subdir
60 -gdb_load ${binfile}
61 +clean_restart ${testfile}
62  
63  # regexp for "horizontal" text (i.e. doesn't include newline or
64  # carriage return)
65 @@ -53,7 +50,6 @@ set horiz "\[^\n\r\]*"
66  # regexp for newline
67  set nl "\[\r\n\]+"
68  
69 -set prev_timeout $timeout
70  set timeout 30
71  
72  gdb_test_multiple "help gcore" "help gcore" {
73 @@ -92,10 +88,9 @@ delete_breakpoints
74  gdb_breakpoint "thread2"
75  gdb_test "continue" "Continuing.*Breakpoint.* thread2 .*" "thread 2 is running"
76  
77 -set escapedfilename [string_to_regexp ${objdir}/${subdir}/gcore.test]
78 +set escapedfilename [string_to_regexp $corefile]
79  # Drop corefile
80 -gdb_test_multiple "gcore ${objdir}/${subdir}/gcore.test" \
81 -       "save a corefile" \
82 +gdb_test_multiple "gcore $corefile" "save a corefile" \
83  {
84    -re "Saved corefile ${escapedfilename}\[\r\n\]+$gdb_prompt $" {
85      pass "save a corefile"
86 @@ -114,31 +109,38 @@ if {!$core_supported} {
87    return -1
88  }
89  
90 +
91  # Now restart gdb and load the corefile.
92 -gdb_exit
93 -gdb_start
94 -gdb_reinitialize_dir $srcdir/$subdir
95 -gdb_load ${binfile}
96 -
97 -gdb_test_multiple "core ${objdir}/${subdir}/gcore.test" \
98 -    "re-load generated corefile" {
99 -       -re ".* is not a core dump:.*$gdb_prompt $" {
100 -           fail "re-load generated corefile (bad file format)"
101 -           # No use proceeding from here.
102 -           return;
103 -       }
104 -       -re ".*: No such file or directory.*$gdb_prompt $" {
105 -           fail "re-load generated corefile (file not found)"
106 -           # No use proceeding from here.
107 -           return;
108 -       }
109 -       -re ".*Couldn't find .* registers in core file.*$gdb_prompt $" {
110 -           fail "re-load generated corefile (incomplete note section)"
111 -       }
112 -       -re "Core was generated by .*$gdb_prompt $" {
113 -           pass "re-load generated corefile"
114 +clean_restart ${testfile}
115 +
116 +proc load_core { corefile } {
117 +    global gdb_prompt
118 +
119 +    gdb_test_multiple "core $corefile" \
120 +       "re-load generated corefile" {
121 +           -re " is not a core dump:.*\r\n$gdb_prompt $" {
122 +               fail "re-load generated corefile (bad file format)"
123 +               # No use proceeding from here.
124 +               return 0;
125 +           }
126 +           -re ": No such file or directory.*\r\n$gdb_prompt $" {
127 +               fail "re-load generated corefile (file not found)"
128 +               # No use proceeding from here.
129 +               return 0;
130 +           }
131 +           -re "Couldn't find .* registers in core file.*\r\n$gdb_prompt $" {
132 +               fail "re-load generated corefile (incomplete note section)"
133 +           }
134 +           -re "Core was generated by .*\r\n$gdb_prompt $" {
135 +               pass "re-load generated corefile"
136 +           }
137         }
138 -    }
139 +    return 1
140 +}
141 +
142 +if ![load_core $corefile] {
143 +    return
144 +}
145  
146  # FIXME: now what can we test about the thread state?
147  # We do not know for certain that there should be at least 
148 @@ -158,5 +160,3 @@ gdb_test "info threads" ".* thread2 .*" \
149  
150  gdb_test "info threads" ".*${nl}\\* ${horiz} thread2 .*" \
151         "thread2 is current thread in corefile"
152 -
153 -set timeout $prev_timeout
154
This page took 0.06388 seconds and 3 git commands to generate.