📄 virtfunc.exp
字号:
} } send_gdb "ptype pVd\n" gdb_expect { -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const ?&\\);${ws}V\\((V const|const V) ?&\\);${ws}V\\((void|)\\);${ws}int f\\((void|)\\);${ws}virtual int vv\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" { pass "ptype pVd" } -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}int f \\((void|)\\);${ws}virtual int vv \\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" { pass "ptype pVd (aCC)" } -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;((${ws}V & operator=\\(V const ?&\\);)|(${ws}V\\(V const ?&\\);)|(${ws}V\\((void|)\\);)|(${ws}int f\\((void|)\\);)|(${ws}virtual int vv\\((void|)\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" { pass "ptype pVd (obsolescent gcc or gdb)" } -re ".*$gdb_prompt $" { fail "ptype pVd" } timeout { fail "ptype pVd (timeout)" } } send_gdb "ptype pADe\n" gdb_expect { -re "type = class AD \{${ws}public:${ws}AD & operator=\\(AD const ?&\\);${ws}AD\\((AD const|const AD) ?&\\);${ws}AD\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" { pass "ptype pADe" } -re "type = class AD \{${ws}public:${ws}virtual int vg \\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" { pass "ptype pADe (aCC)" } -re "type = class AD \{${ws}public:((${ws}AD & operator=\\(AD const ?&\\);)|(${ws}AD\\(AD const ?&\\);)|(${ws}AD\\((void|)\\);)|(${ws}virtual int vg\\((void|)\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" { pass "ptype pADe (obsolescent gcc or gdb)" } -re ".*$gdb_prompt $" { fail "ptype pADe" } timeout { fail "ptype pADe (timeout)" } } send_gdb "ptype pEe\n" gdb_expect { -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;${ws}E & operator=\\(E const ?&\\);${ws}E\\(int, E const ?&\\);${ws}E\\(int\\);${ws}virtual int f\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vv\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" { pass "ptype pEe" } -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;${ws}E & operator=\\(E const ?&\\);${ws}E\\((E const|const E) ?&\\);${ws}E\\((void|)\\);${ws}virtual int f\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vv\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" { pass "ptype pEe" } -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;${ws}virtual int f \\((void|)\\);${ws}virtual int vg \\((void|)\\);${ws}virtual int vv \\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" { pass "ptype pEe (aCC)" } -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;((${ws}E & operator=\\(E const ?&\\);)|(${ws}E\\(int, E const ?&\\);)|(${ws}E\\(int\\);)|(${ws}virtual int f\\((void|)\\);)|(${ws}virtual int vg\\((void|)\\);)|(${ws}virtual int vv\\((void|)\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" { pass "ptype pEe (obsolescent gcc or gdb)" } -re ".*$gdb_prompt $" { fail "ptype pEe" } timeout { fail "ptype pEe (timeout)" } } send_gdb "ptype pVB\n" gdb_expect { -re "type = class VB \{${ws}public:${ws}int vb;${ws}VB & operator=\\(VB const ?&\\);${ws}VB\\((VB const|const VB) ?&\\);${ws}VB\\((void|)\\);${ws}int fvb\\((void|)\\);${ws}virtual int vvb\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" { pass "ptype pVB" } -re "type = class VB \{${ws}public:${ws}int vb;${ws}int fvb \\((void|)\\);${ws}virtual int vvb \\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" { pass "ptype pVB (aCC)" } -re "type = class VB \{${ws}public:${ws}int vb;((${ws}VB & operator=\\(VB const ?&\\);)|(${ws}VB\\(VB const ?&\\);)|(${ws}VB\\((void|)\\);)|(${ws}int fvb\\((void|)\\);)|(${ws}virtual int vvb\\((void|)\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" { pass "ptype pVB (obsolescent gcc or gdb)" } -re ".*$gdb_prompt $" { fail "ptype pVB" } timeout { fail "ptype pVB (timeout)" } }}## Test calling of virtual functions.#proc test_virtual_calls {} { global gdb_prompt global GDB global nl global gcc_compiled if [target_info exists gdb,cannot_call_functions] { setup_xfail "*-*-*" 2416 fail "This target can not call functions" return 0 } send_gdb "print pAe->f()\n" gdb_expect { -re ".* = 20$nl$gdb_prompt $" { pass "print pAe->f()" } -re "Cannot invoke functions on this machine.*$gdb_prompt $" { fail "print pAe->f() (cannot invoke functions, skipping virtual calls)" return 0 } -re ".*Cannot access memory at address 0x8.*$gdb_prompt $" { fail "print pAe->f() \(known failure with gcc cygnus-2.4.5-930417, skipping virtual calls)" return 0 } -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" { setup_xfail hppa*-*-* CLLbs16899 fail "print pAe->f()" } -re ".*$gdb_prompt $" { fail "print pAe->f()" } timeout { fail "print pAe->f() (timeout)" } eof { fail "print pAe->f() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } } send_gdb "print pAa->f()\n" gdb_expect { -re ".* = 1$nl$gdb_prompt $" { pass "print pAa->f()" } -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" { setup_xfail hppa*-*-* CLLbs16899 fail "print pAa->f()" } -re ".*$gdb_prompt $" { fail "print pAa->f()" } timeout { fail "print pAa->f() (timeout)" } eof { fail "print pAa->f() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } } send_gdb "print pDe->vg()\n" gdb_expect { -re ".* = 202$nl$gdb_prompt $" { pass "print pDe->vg()" } -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" { setup_xfail hppa*-*-* CLLbs16899 fail "print pDe->vg()" } -re ".*$gdb_prompt $" { fail "print pDe->vg()" } timeout { fail "print pDe->vg() (timeout)" } eof { fail "print pDe->vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } } send_gdb "print pADe->vg()\n" gdb_expect { -re ".* = 202$nl$gdb_prompt $" { pass "print pADe->vg()" } -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" { setup_xfail hppa*-*-* CLLbs16899 fail "print pADe->vg()" } -re ".*$gdb_prompt $" { fail "print pADe->vg()" } timeout { fail "print pADe->vg() (timeout)" } eof { fail "print pADe->vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } } send_gdb "print pDd->vg()\n" gdb_expect { -re ".* = 101$nl$gdb_prompt $" { pass "print pDd->vg()" } -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" { setup_xfail hppa*-*-* CLLbs16899 fail "print pDd->vg()" } -re ".*$gdb_prompt $" { fail "print pDd->vg()" } timeout { fail "print pDd->vg() (timeout)" } eof { fail "print pDd->vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } } send_gdb "print pEe->vvb()\n" gdb_expect { -re ".* = 411$nl$gdb_prompt $" { pass "print pEe->vvb()" } -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" { setup_xfail hppa*-*-* CLLbs16899 fail "print pEe->vvb()" } -re ".*$gdb_prompt $" { fail "print pEe->vvb()" } timeout { fail "print pEe->vvb() (timeout)" } eof { fail "print pEe->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } } send_gdb "print pVB->vvb()\n" gdb_expect { -re ".* = 407$nl$gdb_prompt $" { pass "print pVB->vvb()" } -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" { setup_xfail hppa*-*-* CLLbs16899 fail "print pVB->vvb()" } -re ".*$gdb_prompt $" { fail "print pVB->vvb()" } timeout { fail "print pVB->vvb() (timeout)" } eof { fail "print pVB->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } } # fails on target=native, host=i686-pc-linux-gnu%rh-7.2, # gdb=HEAD%2002-02-16, gcc=2.95.3, goption=-gdwarf-2. # -- chastain 2002-02-20 if {$gcc_compiled} then { setup_xfail "*-*-*" } send_gdb "print pBe->vvb()\n" gdb_expect { -re ".* = 411$nl$gdb_prompt $" { pass "print pBe->vvb()" } -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" { setup_xfail hppa*-*-* CLLbs16899 fail "print pBe->vvb()" } -re ".*$gdb_prompt $" { fail "print pBe->vvb()" } timeout { fail "print pBe->vvb() (timeout)" } eof { fail "print pBe->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } } send_gdb "print pDe->vvb()\n" gdb_expect { -re ".* = 411$nl$gdb_prompt $" { pass "print pDe->vvb()" } -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" { setup_xfail hppa*-*-* CLLbs16899 fail "print pDe->vvb()" } -re ".*$gdb_prompt $" { fail "print pDe->vvb()" } timeout { fail "print pDe->vvb() (timeout)" } eof { fail "print pDe->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } } send_gdb "print pEe->vd()\n" gdb_expect { -re ".* = 282$nl$gdb_prompt $" { pass "print pEe->vd()" } -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" { setup_xfail hppa*-*-* CLLbs16899 fail "print pEe->vd()" } -re ".*$gdb_prompt $" { fail "print pEe->vd()" } timeout { fail "print pEe->vd() (timeout)" } eof { fail "print pEe->vd() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } } send_gdb "print pEe->fvb()\n" gdb_expect { -re ".* = 311$nl$gdb_prompt $" { pass "print pEe->fvb()" } -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" { setup_xfail hppa*-*-* CLLbs16899 fail "print pEe->fvb()" } -re ".*$gdb_prompt $" { fail "print pEe->fvb()" } timeout { fail "print pEe->fvb() (timeout)" } eof { fail "print pEe->fvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } } # fails on target=native, host=i686-pc-linux-gnu%rh-7.2, # gdb=HEAD%2002-02-16, gcc=2.95.3, goption=-gdwarf-2. # # fails on target=native, host=i686-pc-linux-gnu%rh-7.2, # gdb=HEAD%2002-02-16, gcc=2.95.3, goption=-gstabs+. # # fails on target=native, host=i686-pc-linux-gnu%rh-7.2, # gdb=HEAD%2002-02-16, gcc=3.0.3, goption=-gdwarf-2. # # fails on target=native, host=i686-pc-linux-gnu%rh-7.2, # gdb=HEAD%2002-02-16, gcc=3.0.3, goption=-gstabs+. # # fails on target=native, host=i686-pc-linux-gnu%rh-7.2, # gdb=HEAD%2002-02-16, gcc=3.0.4-20020215, goption=-gdwarf-2. # # fails on target=native, host=i686-pc-linux-gnu%rh-7.2, # gdb=HEAD%2002-02-16, gcc=3.0.4-20020215, goption=-gstabs+. # # fails on target=native, host=i686-pc-linux-gnu%rh-7.2, # gdb=HEAD%2002-02-16, gcc=gcc-3_0-branch%2002-02-16, goption=-gdwarf-2. # # fails on target=native, host=i686-pc-linux-gnu%rh-7.2, # gdb=HEAD%2002-02-16, gcc=gcc-3_0-branch%2002-02-16, goption=-gstabs+. # # fails on target=native, host=i686-pc-linux-gnu%rh-7.2, # gdb=HEAD%2002-02-16, gcc=HEAD%2002-02-16, goption=-gdwarf-2. # # fails on target=native, host=i686-pc-linux-gnu%rh-7.2, # gdb=HEAD%2002-02-16, gcc=HEAD%2002-02-16, goption=-gstabs+. # # -- chastain 2002-02-20 if {$gcc_compiled} then { setup_xfail "*-*-*" } send_gdb "print pEe->D::vg()\n" setup_xfail "*-*-*" gdb_expect { -re ".* = 102$nl$gdb_prompt $" { pass "print pEe->D::vg()" } -re ".*$gdb_prompt $" { fail "print pEe->D::vg()" } timeout { fail "print pEe->D::vg() (timeout)" } eof { fail "print pEe->D::vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } }}proc do_tests {} { global prms_id global bug_id set prms_id 0 set bug_id 0 gdb_start; gdb_virtfunc_init; # Get the debug format for the compiled test case. If that # format is DWARF 1 then just skip all the tests since none of # them will pass. if [ runto_main ] then { get_debug_format if [ setup_xfail_format "DWARF 1" ] then { fail "C++ tests skipped due to limited C++ support in DWARF 1 debug format" return } clear_xfail "*-*-*" } test_ptype_of_classes if [ runto 'test_calls' ] then { test_virtual_calls }}do_tests
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -