From: Simon Marchi <simon.marchi@ericsson.com>
To: Phil Muldoon <pmuldoon@redhat.com>,
"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Cc: Keith Seitz <keiths@redhat.com>
Subject: Re: [python] Allow explicit locations in breakpoints.
Date: Mon, 16 Oct 2017 18:31:00 -0000 [thread overview]
Message-ID: <a1f30ba8-eb97-ccc0-52e8-05d8280bbfa8@ericsson.com> (raw)
In-Reply-To: <04ccc2c4-7827-eedc-d8db-a83a0167acb6@redhat.com>
> diff --git a/gdb/testsuite/gdb.python/py-breakpoint.exp b/gdb/testsuite/gdb.python/py-breakpoint.exp
> index bd138ac3d2..228489f74e 100644
> --- a/gdb/testsuite/gdb.python/py-breakpoint.exp
> +++ b/gdb/testsuite/gdb.python/py-breakpoint.exp
> @@ -547,6 +547,72 @@ proc test_bkpt_events {} {
> check_last_event breakpoint_deleted
> }
>
> +proc test_bkpt_explicit_loc {} {
> + global srcfile testfile
> +
> + with_test_prefix test_bkpt_invisible {
This should be test_bkpt_explicit_loc. But I think I'll do a pass
and make all these procs use "proc_with_prefix", to avoid having to
repeat the proc name.
> + # Start with a fresh gdb.
> + clean_restart ${testfile}
> +
> + if ![runto_main] then {
> + fail "cannot run to main."
> + return 0
> + }
> +
> + delete_breakpoints
> +
> + set bp_location1 [gdb_get_line_number "Break at multiply."]
> + set bp_location2 [gdb_get_line_number "Break at add."]
> +
> + gdb_py_test_silent_cmd "python bp1 = gdb.Breakpoint (\"-li $bp_location1\")" \
> + "Set explicit breakpoint by line" 0> + gdb_continue_to_breakpoint "Break at multiply" \
> + ".*Break at multiply.*"
> + gdb_py_test_silent_cmd "python bp1 = gdb.Breakpoint (\"-li +1\")" \
> + "Set explicit breakpoint by relative line" 0
> + gdb_continue_to_breakpoint "Break at add" \
> + ".*Break at add.*"
> + delete_breakpoints
> + gdb_py_test_silent_cmd "python bp1 = gdb.Breakpoint (\"-li -1\")" \
> + "Set explicit breakpoint by relative negative line" 0
> + gdb_continue_to_breakpoint "Break at multiply" \
> + ".*Break at multiply.*"
> + delete_breakpoints
> + gdb_py_test_silent_cmd "python bp1 = gdb.Breakpoint (\"-function add\")" \
> + "Set explicit breakpoint by function" 0
> + gdb_continue_to_breakpoint "Break at function add" \
> + ".*Break at function add.*"
> + delete_breakpoints
> + gdb_py_test_silent_cmd "python bp1 = gdb.Breakpoint (\"-source $srcfile -function add\")" \
> + "Set explicit breakpoint by source file and function" 0
> + gdb_continue_to_breakpoint "Break at function add" \
> + ".*Break at function add.*"
> + delete_breakpoints
> + gdb_py_test_silent_cmd "python bp1 = gdb.Breakpoint (\"-source $srcfile -li $bp_location2\")" \
> + "Set explicit breakpoint by source file and line number" 0
> + gdb_continue_to_breakpoint "Break at add" \
> + ".*Break at add.*"
> + delete_breakpoints
> + gdb_test "python bp1 = gdb.Breakpoint (\"-source $srcfile\")" \
> + "RuntimeError: Source filename requires function, label, or line offset.*" \
> + "Set invalid explicit breakpoint by source only"
> + # The below will print a warning but set pending breakpoints.
> + gdb_test "python bp1 = gdb.Breakpoint (\"-source foo.c -li 5\")" \
> + "No source file named foo.*" \
> + "Set invalid explicit breakpoint by missing source and line"
> + gdb_test "python bp1 = gdb.Breakpoint (\"-source $srcfile -li 900\")" \
> + "No line 900 in file \"$srcfile\".*" \
> + "Set invalid explicit breakpoint by source and invalid line."
> + gdb_test "python bp1 = gdb.Breakpoint (\"-function blah\")" \
> + "Function \"blah\" not defined.*" \
> + "Set invalid explicit breakpoint by missing function."
> + # Invalid explicit location flags.
> + gdb_test "python bp1 = gdb.Breakpoint (\"-foo -li 5\")" \
> + "RuntimeError: invalid explicit location argument, \"-foo\".*" \
> + "Set invalid explicit breakpoint by wrong flag"
For readability, could you add some empty lines between the logical blocks above?
> + }
> +}
> +
> test_bkpt_basic
> test_bkpt_deletion
> test_bkpt_cond_and_cmds
> @@ -558,3 +624,4 @@ test_bkpt_temporary
> test_bkpt_address
> test_bkpt_pending
> test_bkpt_events
> +test_bkpt_explicit_loc
>
Simon
prev parent reply other threads:[~2017-10-16 18:31 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <04ccc2c4-7827-eedc-d8db-a83a0167acb6@redhat.com>
2017-08-23 17:51 ` Keith Seitz
2017-08-23 18:31 ` Phil Muldoon
2017-10-16 18:23 ` Simon Marchi
2017-10-16 18:33 ` Simon Marchi
2017-10-16 20:24 ` Phil Muldoon
2017-10-16 21:26 ` Simon Marchi
2017-10-16 22:01 ` Phil Muldoon
2017-10-16 22:26 ` Simon Marchi
2017-11-17 11:02 ` Phil Muldoon
2017-11-17 13:31 ` Eli Zaretskii
2017-11-17 14:02 ` Phil Muldoon
2017-11-23 22:17 ` Simon Marchi
2017-11-24 14:07 ` Phil Muldoon
2017-12-07 10:02 ` Phil Muldoon
2017-12-07 12:16 ` Phil Muldoon
2017-12-07 14:54 ` Simon Marchi
2017-12-07 15:12 ` Phil Muldoon
2017-12-07 16:41 ` Simon Marchi
2017-12-08 13:50 ` Eli Zaretskii
2017-09-12 10:03 ` Phil Muldoon
2017-10-02 15:18 ` Phil Muldoon
2017-10-16 11:14 ` Phil Muldoon
2017-10-16 18:31 ` Simon Marchi [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a1f30ba8-eb97-ccc0-52e8-05d8280bbfa8@ericsson.com \
--to=simon.marchi@ericsson.com \
--cc=gdb-patches@sourceware.org \
--cc=keiths@redhat.com \
--cc=pmuldoon@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox