[PATCH 3/8] Python: Use correct ptid in btrace recording

Yao Qi qiyaoltc@gmail.com
Thu Apr 20 09:41:00 GMT 2017


Tim Wiederhake <tim.wiederhake@intel.com> writes:

> +
> +# Thread 1 is supposed to call func1 (), thread 2 is supposed to call func2 ().
> +# Check that the function call history for the current thread contains a call
> +# to the right function and does not contain a call to the wrong function.
> +proc check_insn_for_thread { self other } {

Need to switch current thread to "self".

> +  gdb_test_no_output "python fch = rec$self.function_call_history"
> +  gdb_test_no_output "python f1calls = \{x for x in fch if x.symbol and x.symbol.name == \"func1\"\}"
> +  gdb_test_no_output "python f2calls = \{x for x in fch if x.symbol and x.symbol.name == \"func2\"\}"
> +
> +  gdb_test "python print not f${self}calls" "False"
> +  gdb_test "python print not f${other}calls" "True"
> +}
> +
> +with_test_prefix "thread 1" {
> +  check_insn_for_thread 1 2
> +}
> +
> +with_test_prefix "thread 2" {
> +  check_insn_for_thread 2 1
> +}

You can move with_test_prefix into check_insn_for_thread,

proc check_insn_for_thread { self other } {
  with_test_prefix "treadh $self" {
  }
}

-- 
Yao (齐尧)



More information about the Gdb-patches mailing list