diff options
author | Keith Seitz <keiths@redhat.com> | 2015-08-11 17:09:36 -0700 |
---|---|---|
committer | Keith Seitz <keiths@redhat.com> | 2015-08-11 17:09:36 -0700 |
commit | eb8c4e2e66329dc7bf2024d55991efe8587075c0 (patch) | |
tree | c22ee99930bed86360da1dd551f17d6c2ba89f36 /gdb/testsuite/gdb.mi | |
parent | 87f0e7204722a986f79f245eee716f0870832d47 (diff) | |
download | fsf-binutils-gdb-eb8c4e2e66329dc7bf2024d55991efe8587075c0.zip fsf-binutils-gdb-eb8c4e2e66329dc7bf2024d55991efe8587075c0.tar.gz fsf-binutils-gdb-eb8c4e2e66329dc7bf2024d55991efe8587075c0.tar.bz2 |
Explicit locations: MI support for explicit locations
This patch adds support for explicit locations to MI's -break-insert
command. The new options, documented in the User Manual, are
--source, --line, --function, and --label.
gdb/ChangeLog:
* mi/mi-cmd-break.c (mi_cmd_break_insert_1): Add support for
explicit locations, options "--source", "--function",
"--label", and "--line".
gdb/testsuite/ChangeLog:
* gdb.mi/mi-break.exp (test_explicit_breakpoints): New proc.
(at toplevel): Call test_explicit_breakpoints.
* gdb.mi/mi-dprintf.exp: Add tests for explicit dprintf
breakpoints.
* lib/mi-support.exp (mi_make_breakpoint): Add support for
breakpoint conditions, "-cond".
Diffstat (limited to 'gdb/testsuite/gdb.mi')
-rw-r--r-- | gdb/testsuite/gdb.mi/mi-break.exp | 82 | ||||
-rw-r--r-- | gdb/testsuite/gdb.mi/mi-dprintf.exp | 12 |
2 files changed, 93 insertions, 1 deletions
diff --git a/gdb/testsuite/gdb.mi/mi-break.exp b/gdb/testsuite/gdb.mi/mi-break.exp index a86ba8c..60bab0e 100644 --- a/gdb/testsuite/gdb.mi/mi-break.exp +++ b/gdb/testsuite/gdb.mi/mi-break.exp @@ -305,6 +305,86 @@ proc test_breakpoint_commands {} { mi_expect_stop "exited-normally" "" "" "" "" "" "test hitting breakpoint with commands" } +# Test explicit breakpoints. These tests only test the MI portion of the +# code. In-depth testing of explicit breakpoints is accomplished in +# gdb.linespec tests. + +proc test_explicit_breakpoints {} { + global srcfile + global line_callee3_head line_callee4_head + global line_callee2_body line_main_body + + mi_delete_breakpoints + + # First check mixed explicit/parsed linespecs. + mi_gdb_test "-break-insert --function main $srcfile:$line_callee3_head" \ + ".*Garbage following explicit linespec" + + # Insert some breakpoints and list them + # Also, disable some so they do not interfere with other tests + # Tests: + # -break-insert -t --function main + # -break-insert -t --source basics.c --function callee2 + # -break-insert -t --source basics.c --line $line_callee3_head + # -break-insert -t --source srcfile --line $line_callee4_head + # -break-list + + set bps {} + lappend bps [mi_create_breakpoint "-t --function main" \ + "insert temp explicit breakpoint in main" \ + -func main -file ".*$srcfile" -line $line_main_body] + + lappend bps \ + [mi_create_breakpoint "-t --source $srcfile --function callee2" \ + "insert temp explicit breakpoint at $srcfile:callee2" \ + -func callee2 -file ".*$srcfile" -line $line_callee2_body] + + lappend bps \ + [mi_create_breakpoint "-t --source $srcfile --line $line_callee3_head" \ + "insert temp explicit breakpoint at $srcfile:$line_callee3_head" \ + -func callee3 -file ".*$srcfile" -line $line_callee3_head] + + lappend bps \ + [mi_create_breakpoint \ + "-t --source \"$srcfile\" --line $line_callee4_head" \ + "insert temp explicit breakpoint at \"$srcfile\":$line_callee4_head" \ + -func callee4 -file ".*$srcfile" -line $line_callee4_head] + + mi_gdb_test "-break-list" "\\^done,[mi_make_breakpoint_table $bps]" \ + "list of explicit breakpoints" + + mi_gdb_test "-break-delete" \ + "\\^done" \ + "delete temp breakpoints" + + mi_create_breakpoint "-c \"intarg == 3\" --function callee2" \ + "insert explicit conditional breakpoint in callee2" \ + -func callee2 ".*$srcfile" -line $line_callee2_body \ + -cond "intarg == 3" + + # mi_create_breakpoint cannot deal with displaying canonical + # linespecs. + mi_gdb_test \ + "-break-insert -c \"foo == 3\" --source $srcfile --function main --label label" \ + ".*No symbol \"foo\" in current context.*" + + mi_gdb_test \ + "-break-insert --source foobar.c --line 3" \ + ".*No source file named foobar.c.*" + + mi_gdb_test \ + "-break-insert --source $srcfile --function foobar" \ + ".*Function \"foobar\" not defined in \"$srcfile\".*" + + mi_gdb_test \ + "-break-insert --source $srcfile --function main --label foobar" \ + ".*No label \"foobar\" defined in function \"main\".*" + + mi_gdb_test \ + "-break-insert --source $srcfile" \ + ".*Source filename requires function, label, or line offset.*" +} + test_tbreak_creation_and_listing test_rbreak_creation_and_listing @@ -318,5 +398,7 @@ test_breakpoint_commands test_abreak_creation +test_explicit_breakpoints + mi_gdb_exit return 0 diff --git a/gdb/testsuite/gdb.mi/mi-dprintf.exp b/gdb/testsuite/gdb.mi/mi-dprintf.exp index c205724..08885e9 100644 --- a/gdb/testsuite/gdb.mi/mi-dprintf.exp +++ b/gdb/testsuite/gdb.mi/mi-dprintf.exp @@ -47,6 +47,16 @@ mi_gdb_test "[incr i]-dprintf-insert 29" \ "$i\\^error,msg=\"-dprintf-insert: Missing <format>\"" "mi insert second breakpoint without format string" mi_gdb_test "-break-insert main" ".*" "mi insert breakpoint main" + +mi_gdb_test "-dprintf-insert --function main \"hello\"" \ + "\\^done,bkpt={.*}" "explicit dprintf at main" + +mi_gdb_test "-dprintf-insert --source $srcfile --line $dp_location1 \"hello\"" \ + "\\^done,bkpt={.*}" "explicit breakpoint at $srcfile:$dp_location1" + +mi_gdb_test "-dprintf-insert --source $srcfile \"hello\"" \ + "\\^error,msg=\"-dprintf-insert: --source option requires --function, --label, or --line\"" "invalid explicit dprintf" + mi_delete_breakpoints set bps [mi_make_breakpoint -type dprintf -func foo -file ".*mi-dprintf.c" \ @@ -61,7 +71,7 @@ mi_gdb_test "[incr i]-dprintf-insert $dp_location1 \"arg=%d, g=%d\\n\" arg g" \ "$i\\^done,$bps" "mi insert dprintf dp_location1" set bps {} -lappend bps [mi_make_breakpoint -number 3 -type dprintf -func foo \ +lappend bps [mi_make_breakpoint -type dprintf -func foo \ -file ".*mi-dprintf.c" -fullname ".*mi-dprintf.c"] lappend bps [mi_make_breakpoint -type dprintf -func foo \ -file ".*mi-dprintf.c" -fullname ".*mi-dprintf.c" \ |