aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base/langs.exp
blob: 7ac954be4c35d12f7ff8ef446a49f49224eeb39a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
if $tracelevel then {
	strace $tracelevel
}

set prms_id 0
set bug_id 0

set binfile $objdir/$subdir/langs

if ![file exists $binfile] then {
    perror "$binfile does not exist."
    return 0
}

gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $binfile

source gdb.base/langs0.ci

gdb_test "b langs0" {Function "langs0" not defined\.} \
    "break on nonexistent function in langs.exp"

if [runto csub] then {
    gdb_test "show language" "currently c\".*" \
	"show language at csub in langs.exp"
    # On some machines, foo doesn't get demangled because the N_SOL for
    # langs2.cxx is seen only after the function stab for foo.  So
    # the following regexps are kludged to accept foo__Fi as well as foo,
    # even though only the latter is correct.  I haven't tried to xfail it
    # because it depends on details of the compiler.
    gdb_test "bt" "#0.*csub.*#1.*(foo|foo__Fi) \\(.*#2.*cppsub_ .*#3.*fsub.*#4.*langs0__2do \\(.*#5  \[0-9a-fx\]* in main.*" "backtrace in langs.exp"

    if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
    setup_xfail "i*86-*-sysv4*"
    gdb_test "up" ".* in (foo|foo__Fi) .* at langs2\\.cxx.*return csub \\(.*" \
	"up to foo in langs.exp"
    setup_xfail "i*86-*-sysv4*"
    gdb_test "show language" "currently c\\+\\+.*" \
	"show language at foo in langs.exp"

    setup_xfail "i*86-*-sysv4*"
    if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
    gdb_test "up" ".* in cppsub_ .* at langs2\\.cxx.*return foo \\(.*" \
	"up to cppsub_ in langs.exp"
    setup_xfail "i*86-*-sysv4*"
    gdb_test "show language" "currently c\\+\\+.*" \
	"show language at cppsub_ in langs.exp"

    setup_xfail "i*86-*-sysv4*"
    if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
    gdb_test "up" ".* in fsub.* at langs1\\.f.*return \\(cppsub .*" \
	"up to fsub in langs.exp"
    setup_xfail "i*86-*-sysv4*"
    gdb_test "show language" "currently fortran.*" \
	"show language at fsub in langs.exp"

    gdb_test "up" ".* in langs0__2do .* at .*langs0\\.c.*return fsub.*" \
	"up to langs0__2do in langs.exp"
    gdb_test "show language" "currently c\".*" \
	"show language at langs0__2do in langs.exp"

    gdb_test "up" ".* in main .* at .*langs0\\.c.*if \\(langs0__2do \\(.*" \
	"up to main in langs.exp"
    gdb_test "show language" "currently c\".*" \
	"show language at main in langs.exp"

    gdb_test "cont" "Program exited normally\\." \
	"continue to exit in langs.exp"
}

return 0