This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
I wrote a testcase for testing basic gdbserver functionality over TCP connection. I will add more cases like step, print, etc once the testcase is approved. ======================================================================== 2005-05-04 Manoj Iyer <manjo@austin.ibm.com> * gdb.server/basictest.c: New testcase * gdb.server/basictest.exp: New testcase ============= basictest.c ========================= /* File: test basic remote debug functionality through TCP connection. */ /* Author: Manoj Iyer <manjo@austin.ibm.com> */ #include <stdio.h> #include <stdlib.h> static void function3() { printf("In function 3\n"); exit(0); } static void function2() { function3(); } static void function1() { function2(); } main() { printf("hello gdb\n"); function1(); } ====================================================================== ======================= basictest.exp =============================== # This testcase is part of GDB, the GNU debugger. # Copyright 2005 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Test the remote TCP debug functionality of GDB. # Author: Manoj Iyer <manjo@austin.ibm.com> load_lib gdbserver-support.exp set testfile "basictest" set srcfile ${testfile}.c set binfile ${objdir}/${subdir}/${testfile} if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } { gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } gdb_exit global gdbport set ret [gdbserver_spawn $binfile ""] set gdbport [lindex $ret 1] gdb_start send_gdb "file $binfile \n " gdb_target_cmd "remote" $gdbport send_gdb "list \n" gdb_expect { -re ".*function1.*main.*\{.*printf.*$gdb_prompt $" { pass "list commands can display source code" } timeout { fail "list command failed to display source code" } } gdb_test "br main" "Breakpoint 1.*at.* file .*$srcfile, line \[0-9\]+.*" gdb_test "continue" ".*Continuing\\..*Breakpoint \[0-9\]+, main.*at .*$srcfile:\[0-9\].*" gdb_test "br function3" "Breakpoint 2.*at.* file .*$srcfile, line \[0-9\]+.*" gdb_test "continue" ".*Continuing\\..*Breakpoint \[0-9\]+, function3.*at .*$srcfile:\[0-9\].*" send_gdb "backtrace\n" gdb_expect_list "backtrace" ".*$gdb_prompt $" { "#0.*function3.*at .*basictest.c:\[0-9\]+" "#1.*function2.*at .*basictest.c:\[0-9\]+" "#2.*function1.*at .*basictest.c:\[0-9\]+" "#3.*main.*at .*basictest.c:\[0-9\]+" } ============================ basictest.exp ==================== ----- manjo +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + Cogito ergo sum + +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Attachment:
basictest.exp
Description: expect script (new testcase)
/* File: test basic remote debug functionality through TCP connection. */ /* Author: Manoj Iyer <manjo@austin.ibm.com> */ #include <stdio.h> #include <stdlib.h> static void function3() { printf("In function 3\n"); exit(0); } static void function2() { function3(); } static void function1() { function2(); } main() { printf("hello gdb\n"); function1(); }
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |