This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 7/7] New test case gdb.base/branch-to-self.exp
- From: Pedro Alves <palves at redhat dot com>
- To: Yao Qi <qiyaoltc at gmail dot com>, gdb-patches at sourceware dot org
- Date: Mon, 11 Apr 2016 16:34:35 +0100
- Subject: Re: [PATCH 7/7] New test case gdb.base/branch-to-self.exp
- Authentication-results: sourceware.org; auth=none
- References: <1458749384-19793-1-git-send-email-yao dot qi at linaro dot org> <1458749384-19793-8-git-send-email-yao dot qi at linaro dot org>
On 03/23/2016 04:09 PM, Yao Qi wrote:
> +#if defined(__arm__) || defined(__aarch64__)
> +#define BRANCH_INSN "b"
> +#elif defined(__x86_64__) || defined(__i386__)
> +#define BRANCH_INSN "jmp"
It's nice when these are indented, like:
#if defined(__arm__) || defined(__aarch64__)
# define BRANCH_INSN "b"
#elif defined(__x86_64__) || defined(__i386__)
# define BRANCH_INSN "jmp"
> +#else
Did you mean to put something here? #error perhaps?
I wonder whether we should just use
while (1);
> +with_test_prefix "single-step" {
> + global testfile
> +
> + clean_restart ${testfile}
> + if ![runto_main] {
> + return -1
> + }
> + set line_num [gdb_get_line_number "loop-line" ${testfile}.c]
> +
> + gdb_test "break ${testfile}.c:${line_num}"
Please avoid line numbers in test messages, as they'll change
as the test evolves in future.
> + gdb_continue_to_breakpoint "hit breakpoint"
> + gdb_test "si" ".*${testfile}.c:${line_num}.*"
> +}
> +
> +with_test_prefix "break-cond" {
> + global testfile
> +
> + foreach_with_prefix side {"host" "target"} {
> +
> + clean_restart ${testfile}
> +
> + if ![runto_main] {
> + return -1
> + }
> +
> + set test "set breakpoint condition-evaluation $side"
> + gdb_test_multiple $test $test {
> + -re "warning: Target does not support breakpoint condition evaluation.\r\nUsing host evaluation mode instead.\r\n$gdb_prompt $" {
> + # Target doesn't support breakpoint condition
> + # evaluation on its side. Skip the test.
> + continue
> + }
> + -re "^$test\r\n$gdb_prompt $" {
> + }
> + }
> +
> + set line_num [gdb_get_line_number "loop-line" ${testfile}.c]
> + gdb_test "break ${testfile}.c:${line_num} if counter > 3"
Likewise.
> +
> + gdb_continue_to_breakpoint "continue to break"
> +
> + gdb_test "p counter" ".* = 5"
> + }
> +}
>
Otherwise LGTM.
Thanks,
Pedro Alves