This is the mail archive of the gdb-patches@sourceware.org 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]

Re: [PATCH 7/7] New test case gdb.base/branch-to-self.exp


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]