diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2013-03-04 19:30:28 +0000 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2013-03-04 19:30:28 +0000 |
commit | 33f448b11ed775f3d4dcf2c21100ba3b239b6b4a (patch) | |
tree | 44b4f4ff304b1518c07b5add2c1018b992864308 /gdb/testsuite/gdb.linespec | |
parent | feb1472522ea3ff9c0456462f36ce2e29be29f28 (diff) | |
download | gdb-33f448b11ed775f3d4dcf2c21100ba3b239b6b4a.zip gdb-33f448b11ed775f3d4dcf2c21100ba3b239b6b4a.tar.gz gdb-33f448b11ed775f3d4dcf2c21100ba3b239b6b4a.tar.bz2 |
gdb/
* linespec.c (struct linespec_canonical_name): New.
(struct linespec_state): Change canonical_names type to it.
(add_sal_to_sals): Change variable canonical_name to canonical. Change
xrealloc element size. Initialize the different CANONICAL fields.
(canonical_to_fullform): New.
(filter_results): Use it. Add variables canonical, fullform and
cleanup.
(struct decode_line_2_item, decode_line_2_compare_items): New.
(decode_line_2): Remove variables iter and item_names, add variables
items and items_count. Modify the code for these new variables.
gdb/testsuite/
* gdb.linespec/base/one/thefile.cc (twodup): New.
(m): Call it.
* gdb.linespec/base/two/thefile.cc (dupname): New.
(n): Call it.
* gdb.linespec/break-ask.exp: New file.
* gdb.linespec/lspec.cc (body_elsewhere): New comment marker.
Diffstat (limited to 'gdb/testsuite/gdb.linespec')
-rw-r--r-- | gdb/testsuite/gdb.linespec/base/one/thefile.cc | 7 | ||||
-rw-r--r-- | gdb/testsuite/gdb.linespec/base/two/thefile.cc | 7 | ||||
-rw-r--r-- | gdb/testsuite/gdb.linespec/break-ask.exp | 100 | ||||
-rw-r--r-- | gdb/testsuite/gdb.linespec/lspec.cc | 2 |
4 files changed, 113 insertions, 3 deletions
diff --git a/gdb/testsuite/gdb.linespec/base/one/thefile.cc b/gdb/testsuite/gdb.linespec/base/one/thefile.cc index f8712c2..0417b7a 100644 --- a/gdb/testsuite/gdb.linespec/base/one/thefile.cc +++ b/gdb/testsuite/gdb.linespec/base/one/thefile.cc @@ -9,9 +9,14 @@ +static int twodup () +{ + return 0; +} + int m(int x) { - return x + 23; /* thefile breakpoint */ + return x + 23 + twodup (); /* thefile breakpoint */ } int NameSpace::overload(int x) diff --git a/gdb/testsuite/gdb.linespec/base/two/thefile.cc b/gdb/testsuite/gdb.linespec/base/two/thefile.cc index f0c04cc..88188a5 100644 --- a/gdb/testsuite/gdb.linespec/base/two/thefile.cc +++ b/gdb/testsuite/gdb.linespec/base/two/thefile.cc @@ -9,10 +9,15 @@ static int dupname(int y) label: return y; } +static int twodup () +{ + return 0; +} + int n(int y) { int v = dupname(y) - 23; /* thefile breakpoint */ - return v; /* after dupname */ + return v + twodup (); /* after dupname */ } int NameSpace::overload(double x) diff --git a/gdb/testsuite/gdb.linespec/break-ask.exp b/gdb/testsuite/gdb.linespec/break-ask.exp new file mode 100644 index 0000000..10945f5 --- /dev/null +++ b/gdb/testsuite/gdb.linespec/break-ask.exp @@ -0,0 +1,100 @@ +# Copyright 2013 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 3 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, see <http://www.gnu.org/licenses/>. + +standard_testfile lspec.cc + +if {[skip_cplus_tests]} { + unsupported ${testfile}.exp + return +} + +set opts {debug c++} +set objfile1 [standard_output_file ${testfile}one.o] +set objfile2 [standard_output_file ${testfile}two.o] + +if { [file pathtype $objdir] == "relative" } { + untested "objdir $objdir should be absolute" + return +} +set saved_pwd [pwd] +cd $srcdir/${subdir}/base/one +set err1 [gdb_compile "thefile.cc" $objfile1 object $opts] +cd $saved_pwd +cd $srcdir/${subdir}/base/two +set err2 [gdb_compile "thefile.cc" $objfile2 object $opts] +cd $saved_pwd +if { $err1 != "" || $err2 != "" } { + untested "compilation failed" + return -1 +} + +if { [gdb_compile "$srcdir/${subdir}/$srcfile $objfile1 $objfile2" \ + $binfile executable $opts] != "" } { + return -1 +} + +clean_restart ${testfile} + +gdb_test_no_output "set multiple-symbols ask" + +gdb_test_no_output "set filename-display absolute" +set cmd "break twodup" +set test "break twodup absolute" +gdb_test_multiple $cmd $test { + -re "^$cmd\r\n\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] \[^\r\n\]+/base/one/thefile\\.cc:twodup\\\(\\\)\r\n\\\[3\\\] \[^\r\n\]+/base/two/thefile\\.cc:twodup\\\(\\\)\r\n> $" { + pass $test + } +} +gdb_test "0" "canceled" + +gdb_test_no_output "set filename-display relative" + +set cmd "break twodup" +set test "break twodup relative" +gdb_test_multiple $cmd $test { + -re "^$cmd\r\n\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] thefile\\.cc:twodup\\\(\\\)\r\n\\\[3\\\] thefile\\.cc:twodup\\\(\\\)\r\n> $" { + pass $test + } +} +gdb_test "2" "^2\r\nBreakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file thefile\\.cc, line \[0-9a-f\]+\\." + +gdb_breakpoint "body_elsewhere" + +gdb_run_cmd +gdb_test "" "Breakpoint \[0-9\]+, twodup \\(\\) at thefile.cc:\[0-9\]+\r\n.*" "expect breakpoint" + +gdb_test "info source" "\r\nLocated in \[^\r\n\]+/base/one/thefile\\.cc\r\n.*" + +gdb_continue_to_breakpoint "body_elsewhere" ".* body_elsewhere marker .*" + +delete_breakpoints + +set cmd "break twodup" +set test "break twodup relative other" +gdb_test_multiple $cmd $test { + -re "^$cmd\r\n\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] thefile\\.cc:twodup\\\(\\\)\r\n\\\[3\\\] thefile\\.cc:twodup\\\(\\\)\r\n> $" { + pass $test + } +} +gdb_test "3" "^3\r\nBreakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file thefile\\.cc, line \[0-9a-f\]+\\." + +gdb_breakpoint "body_elsewhere" + +gdb_run_cmd +gdb_test "" "Breakpoint \[0-9\]+, twodup \\(\\) at thefile.cc:\[0-9\]+\r\n.*" "expect breakpoint other" + +gdb_test "info source" "\r\nLocated in \[^\r\n\]+/base/two/thefile\\.cc\r\n.*" "info source other" + +gdb_continue_to_breakpoint "body_elsewhere other" ".* body_elsewhere marker .*" diff --git a/gdb/testsuite/gdb.linespec/lspec.cc b/gdb/testsuite/gdb.linespec/lspec.cc index b1092e2..bb660fb 100644 --- a/gdb/testsuite/gdb.linespec/lspec.cc +++ b/gdb/testsuite/gdb.linespec/lspec.cc @@ -9,7 +9,7 @@ int NameSpace::overload() int body_elsewhere() { - int x = 5; + int x = 5; /* body_elsewhere marker */ #include "body.h" } |