1 # This testcase is part of GDB
, the GNU debugger.
3 # Copyright
2023-2024 Free Software Foundation
, Inc.
5 # This
program is free software
; you can redistribute it and
/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation
; either version
3 of the License
, or
8 #
(at your option
) any later version.
10 # This
program is distributed in the hope that it will be useful
,
11 # but WITHOUT
ANY WARRANTY
; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License
for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this
program.
If not
, see
<http
://www.gnu.org
/licenses
/>.
18 # Some kernel core files have PID
0 (for the idle task
), check that
19 # GDB can handle such a core file.
23 #
Set CF_NAME
, the
name of the compressed core file within the source
24 # tree
, and CF_SIZE
, the size
(in bytes
) of the uncompressed core
26 if {[istarget
"x86_64-*-linux*"]} {
27 set cf_name $
{testfile
}.x86
-64.core.bz2
30 unsupported
"no pre-generated core file for this target"
34 # Decompress the core file.
35 set corebz2file $
{srcdir
}/$
{subdir
}/$
{cf_name
}
36 set corefile
[decompress_bz2 $corebz2file
]
37 if { $corefile eq
"" } {
38 untested
"failed to bunzip2 the core file"
42 # Check the size of the decompressed core file. Just
for sanity.
43 file stat $
{corefile
} corestat
44 if { $corestat
(size
) != $
{cf_size
} } {
45 untested
"uncompressed core file is the wrong size"
49 # Copy over the corefile
if we are remote testing.
50 set corefile
[gdb_remote_download host $corefile
]
54 #
Load the core file. At one point GDB would assert
, complaining that
55 # the inferior was nullptr.
For now we see a message about the
56 # current thread having terminated
, this is because GDB gets confused
57 # and incorrectly deletes what should be the current thread.
58 gdb_test
"core-file ${corefile}" \
60 "warning: found threads with pid 0, assigned replacement Target Ids: LWP 1, LWP 2" \
62 "Core was generated by \[^\r\n\]+\\." \
63 "Program terminated with signal (?:11|SIGSEGV), Segmentation fault\\." \
64 "#0\\s+$hex in \[^\r\n\]+" \
65 "\\\[Current thread is 1 \\(LWP 1\\)\\\]"] \
66 "check core file termination reason"
68 # And check GDB has found both threads.
69 gdb_test
"info threads" \
71 "\\* 1\\s+LWP 1\\s+$hex in \[^\r\n\]+" \
72 " 2\\s+LWP 2\\s+$hex in \[^\r\n\]+"] \
73 "check both threads are visible"