Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] add testsuite for for backtrace commands with tfile to test the tfile memory read
@ 2012-06-20 10:09 Hui Zhu
  2012-06-20 14:19 ` Yao Qi
  2012-06-20 14:44 ` Yao Qi
  0 siblings, 2 replies; 8+ messages in thread
From: Hui Zhu @ 2012-06-20 10:09 UTC (permalink / raw)
  To: gdb-patches ml; +Cc: Pedro Alves

Hi,

This test is for the fix in
http://sourceware.org/ml/gdb-patches/2012-06/msg00504.html
I test it in amd64 and it work OK.

Please help me review it.

Best,
Hui

2012-06-20  Hui Zhu  <hui_zhu@mentor.com>

	* gdb.trace/tfile.exp: Add new test for backtrace commands
	with tfile to test the tfile memory read.
---
 testsuite/gdb.trace/tfile.exp |   52 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

--- a/testsuite/gdb.trace/tfile.exp
+++ b/testsuite/gdb.trace/tfile.exp
@@ -117,3 +117,55 @@ Not looking at any trace frame.*" \
 gdb_test \
     "interpreter-exec mi \"-target-select tfile basic.tf\"" \
     "\\^connected.*"
+
+#Test the backtrace commands with tfile to test the tfile memory read
+remote_file host delete bt.tf
+
+gdb_exit
+gdb_start
+
+gdb_load $binfile
+
+runto_main
+
+gdb_delete_tracepoints
+set tp1 [gdb_gettpnum write_error_trace_file];
+
+if { [istarget i?86-*-*] } {
+    gdb_trace_setactions "Set actions for collect stack" \
+	    "$tp1" \
+	    "collect *(unsigned char *)\$esp@128" "^$"
+} elseif {[istarget x86_64-*-* ]} {
+    gdb_trace_setactions "Set actions for collect stack" \
+	    "$tp1" \
+	    "collect *(unsigned char *)\$rsp@128" "^$"
+} elseif {[istarget arm*-*-* ] || [istarget mips*-*-* ]} {
+    gdb_trace_setactions "Set actions for collect stack" \
+	    "$tp1" \
+	    "collect *(unsigned char *)\$sp@128" "^$"
+} else {
+    unsupported "don't know howto use tracepoint collect stack in this target"
+    continue
+}
+
+gdb_test_no_output "tstart"
+gdb_test "break done_making_trace_files" ".*" ""
+gdb_test "continue" ".*" ""
+gdb_test_no_output "tstop"
+gdb_test "tsave ./bt.tf" ".*" ""
+
+gdb_exit
+gdb_start
+
+gdb_load $binfile
+
+gdb_test "target tfile bt.tf" "Created tracepoint.*" "load trace file bt.tf"
+gdb_test "tfind 0" \
+    "Found trace frame 0, tracepoint \[0-9\]+.
+\#0  write_error_trace_file ().*" \
+    "tfind 0 on trace file bt.tf"
+
+gdb_test "backtrace" \
+"\#0  write_error_trace_file ().*
+\#1  .* in main .*" \
+    "backtrace on trace file bt.tf"


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] add testsuite for for backtrace commands with tfile to test the tfile memory read
  2012-06-20 10:09 [PATCH] add testsuite for for backtrace commands with tfile to test the tfile memory read Hui Zhu
@ 2012-06-20 14:19 ` Yao Qi
  2012-06-20 14:44 ` Yao Qi
  1 sibling, 0 replies; 8+ messages in thread
From: Yao Qi @ 2012-06-20 14:19 UTC (permalink / raw)
  To: gdb-patches; +Cc: Hui Zhu, Pedro Alves

On Wednesday 20 June 2012 18:08:17 Hui Zhu wrote:
> +#Test the backtrace commands with tfile to test the tfile memory read
> +remote_file host delete bt.tf

It is better to remove temp files when the test is about to finish.

> +
> +gdb_exit
> +gdb_start
> +
> +gdb_load $binfile
> +

These three can be replaced with "clean_restart".

> +runto_main
> +
> +gdb_delete_tracepoints

Is it needed?  IIRC, all breakpoints are removed inside runto_main.

> +set tp1 [gdb_gettpnum write_error_trace_file];
> +
> +if { [istarget i?86-*-*] } {
> +    gdb_trace_setactions "Set actions for collect stack" \
> +           "$tp1" \
> +           "collect *(unsigned char *)\$esp@128" "^$"
> +} elseif {[istarget x86_64-*-* ]} {
> +    gdb_trace_setactions "Set actions for collect stack" \
> +           "$tp1" \
> +           "collect *(unsigned char *)\$rsp@128" "^$"
> +} elseif {[istarget arm*-*-* ] || [istarget mips*-*-* ]} {
> +    gdb_trace_setactions "Set actions for collect stack" \
> +           "$tp1" \
> +           "collect *(unsigned char *)\$sp@128" "^$"
> +} else {
> +    unsupported "don't know howto use tracepoint collect stack in this
> target" +    continue
> +}
> +
> +gdb_test_no_output "tstart"
> +gdb_test "break done_making_trace_files" ".*" ""
> +gdb_test "continue" ".*" ""
> +gdb_test_no_output "tstop"
> +gdb_test "tsave ./bt.tf" ".*" ""
> +
> +gdb_exit
> +gdb_start
> +
> +gdb_load $binfile

clean_restart

> +
> +gdb_test "target tfile bt.tf" "Created tracepoint.*" "load trace file
> bt.tf" +gdb_test "tfind 0" \
> +    "Found trace frame 0, tracepoint \[0-9\]+.
> +\#0  write_error_trace_file ().*" \
> +    "tfind 0 on trace file bt.tf"
> +
> +gdb_test "backtrace" \
> +"\#0  write_error_trace_file ().*
> +\#1  .* in main .*" \
> +    "backtrace on trace file bt.tf"

gdb_test_sequence is convenient to match the output of bt.

-- 
Yao (齐尧)


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] add testsuite for for backtrace commands with tfile to test the tfile memory read
  2012-06-20 10:09 [PATCH] add testsuite for for backtrace commands with tfile to test the tfile memory read Hui Zhu
  2012-06-20 14:19 ` Yao Qi
@ 2012-06-20 14:44 ` Yao Qi
  2012-06-21 11:16   ` Hui Zhu
  1 sibling, 1 reply; 8+ messages in thread
From: Yao Qi @ 2012-06-20 14:44 UTC (permalink / raw)
  To: gdb-patches; +Cc: Hui Zhu, Pedro Alves

Hi, Hui,

I got some fails with your patch applied,

FAIL: gdb.trace/tfile.exp: tstart
FAIL: gdb.trace/tfile.exp: tstop
FAIL: gdb.trace/tfile.exp: load trace file bt.tf (GDB internal error)
FAIL: gdb.trace/tfile.exp: tfind 0 on trace file bt.tf
FAIL: gdb.trace/tfile.exp: backtrace on trace file bt.tf

On Wednesday 20 June 2012 18:08:17 Hui Zhu wrote:
> gdb_test_no_output "tstart"

You start tracing in native, which doesn't support tracepoint.

> +gdb_test "break done_making_trace_files" ".*" ""
> +gdb_test "continue" ".*" ""
> +gdb_test_no_output "tstop"
> +gdb_test "tsave ./bt.tf" ".*" ""

AFAIK, in tfile.exp, trace file is generated by tfile.c and GDB only consumes 
these trace files (basic.tf and error.tf) for test purpose.

-- 
Yao (齐尧)


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] add testsuite for for backtrace commands with tfile to test the tfile memory read
  2012-06-20 14:44 ` Yao Qi
@ 2012-06-21 11:16   ` Hui Zhu
  2012-06-21 14:17     ` Pedro Alves
  0 siblings, 1 reply; 8+ messages in thread
From: Hui Zhu @ 2012-06-21 11:16 UTC (permalink / raw)
  To: Yao Qi; +Cc: gdb-patches, Pedro Alves

On Wed, Jun 20, 2012 at 10:44 PM, Yao Qi <yao@codesourcery.com> wrote:
> Hi, Hui,
>
> I got some fails with your patch applied,
>
> FAIL: gdb.trace/tfile.exp: tstart
> FAIL: gdb.trace/tfile.exp: tstop
> FAIL: gdb.trace/tfile.exp: load trace file bt.tf (GDB internal error)
> FAIL: gdb.trace/tfile.exp: tfind 0 on trace file bt.tf
> FAIL: gdb.trace/tfile.exp: backtrace on trace file bt.tf
>
> On Wednesday 20 June 2012 18:08:17 Hui Zhu wrote:
>> gdb_test_no_output "tstart"
>
> You start tracing in native, which doesn't support tracepoint.
>
>> +gdb_test "break done_making_trace_files" ".*" ""
>> +gdb_test "continue" ".*" ""
>> +gdb_test_no_output "tstop"
>> +gdb_test "tsave ./bt.tf" ".*" ""
>
> AFAIK, in tfile.exp, trace file is generated by tfile.c and GDB only consumes
> these trace files (basic.tf and error.tf) for test purpose.
>
> --
> Yao (齐尧)

Thanks for your help.
Post a new version according to your comments.

Thanks,
Hui

2012-06-21  Hui Zhu  <hui_zhu@mentor.com>

	* gdb.trace/tfile.exp: Add new test for backtrace commands
	with tfile to test the tfile memory read.

---
 testsuite/gdb.trace/tfile.exp |   57 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)

--- a/testsuite/gdb.trace/tfile.exp
+++ b/testsuite/gdb.trace/tfile.exp
@@ -117,3 +117,60 @@ Not looking at any trace frame.*" \
 gdb_test \
     "interpreter-exec mi \"-target-select tfile basic.tf\"" \
     "\\^connected.*"
+
+#Test the backtrace commands with tfile to test the tfile memory read
+if ![gdb_target_supports_trace] {
+    unsupported "target does not support trace"
+    return -1;
+}
+
+if ![is_remote target] {
+    unsupported "target is not remote"
+    return -1;
+}
+
+remote_file host delete bt.tf
+
+clean_restart ${testfile}
+
+runto_main
+
+set tp1 [gdb_gettpnum write_error_trace_file];
+
+if { [istarget i?86-*-*] } {
+    gdb_trace_setactions "Set actions for collect stack" \
+	    "$tp1" \
+	    "collect *(unsigned char *)\$esp@128" "^$"
+} elseif {[istarget x86_64-*-* ]} {
+    gdb_trace_setactions "Set actions for collect stack" \
+	    "$tp1" \
+	    "collect *(unsigned char *)\$rsp@128" "^$"
+} elseif {[istarget arm*-*-* ] || [istarget mips*-*-* ]} {
+    gdb_trace_setactions "Set actions for collect stack" \
+	    "$tp1" \
+	    "collect *(unsigned char *)\$sp@128" "^$"
+} else {
+    unsupported "don't know howto use tracepoint collect stack in this target"
+    continue
+}
+
+gdb_test_no_output "tstart"
+gdb_test "break done_making_trace_files" ".*" ""
+gdb_test "continue" ".*" ""
+gdb_test_no_output "tstop"
+gdb_test "tsave ./bt.tf" ".*" ""
+
+clean_restart ${testfile}
+
+gdb_test "target tfile bt.tf" "Created tracepoint.*" "load trace file bt.tf"
+gdb_test "tfind 0" \
+    "Found trace frame 0, tracepoint \[0-9\]+.
+\#0  write_error_trace_file ().*" \
+    "tfind 0 on trace file bt.tf"
+
+gdb_test_sequence "backtrace" "backtrace on trace file bt.tf" {
+    "\[\r\n\]+#0 .* write_error_trace_file \(\)"
+    "\[\r\n\]+#1 .* main"
+}
+
+remote_file host delete bt.tf


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] add testsuite for for backtrace commands with tfile to test the tfile memory read
  2012-06-21 11:16   ` Hui Zhu
@ 2012-06-21 14:17     ` Pedro Alves
  2012-06-22  1:43       ` Hui Zhu
  0 siblings, 1 reply; 8+ messages in thread
From: Pedro Alves @ 2012-06-21 14:17 UTC (permalink / raw)
  To: Hui Zhu; +Cc: Yao Qi, gdb-patches

On 06/21/2012 12:15 PM, Hui Zhu wrote:

>> >
>> > AFAIK, in tfile.exp, trace file is generated by tfile.c and GDB only consumes
>> > these trace files (basic.tf and error.tf) for test purpose.
>> >
> Thanks for your help.
> Post a new version according to your comments.
> 
> Thanks,
> Hui
> 
> 2012-06-21  Hui Zhu  <hui_zhu@mentor.com>
> 
> 	* gdb.trace/tfile.exp: Add new test for backtrace commands
> 	with tfile to test the tfile memory read.


How was this tested?

-- 
Pedro Alves


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] add testsuite for for backtrace commands with tfile to test the tfile memory read
  2012-06-21 14:17     ` Pedro Alves
@ 2012-06-22  1:43       ` Hui Zhu
  2012-06-22  9:05         ` Pedro Alves
  0 siblings, 1 reply; 8+ messages in thread
From: Hui Zhu @ 2012-06-22  1:43 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Yao Qi, gdb-patches

On Thu, Jun 21, 2012 at 10:16 PM, Pedro Alves <palves@redhat.com> wrote:
> On 06/21/2012 12:15 PM, Hui Zhu wrote:
>
>>> >
>>> > AFAIK, in tfile.exp, trace file is generated by tfile.c and GDB only consumes
>>> > these trace files (basic.tf and error.tf) for test purpose.
>>> >
>> Thanks for your help.
>> Post a new version according to your comments.
>>
>> Thanks,
>> Hui
>>
>> 2012-06-21  Hui Zhu  <hui_zhu@mentor.com>
>>
>>       * gdb.trace/tfile.exp: Add new test for backtrace commands
>>       with tfile to test the tfile memory read.
>
>
> How was this tested?
>
> --
> Pedro Alves

?


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] add testsuite for for backtrace commands with tfile to test the tfile memory read
  2012-06-22  1:43       ` Hui Zhu
@ 2012-06-22  9:05         ` Pedro Alves
  2012-06-24  7:39           ` Hui Zhu
  0 siblings, 1 reply; 8+ messages in thread
From: Pedro Alves @ 2012-06-22  9:05 UTC (permalink / raw)
  To: Hui Zhu; +Cc: Yao Qi, gdb-patches

On 06/22/2012 02:42 AM, Hui Zhu wrote:

> On Thu, Jun 21, 2012 at 10:16 PM, Pedro Alves <palves@redhat.com> wrote:
>> On 06/21/2012 12:15 PM, Hui Zhu wrote:
>>
>>>>>
>>>>> AFAIK, in tfile.exp, trace file is generated by tfile.c and GDB only consumes
>>>>> these trace files (basic.tf and error.tf) for test purpose.
>>>>>
>>> Thanks for your help.
>>> Post a new version according to your comments.
>>>
>>> Thanks,
>>> Hui
>>>
>>> 2012-06-21  Hui Zhu  <hui_zhu@mentor.com>
>>>
>>>       * gdb.trace/tfile.exp: Add new test for backtrace commands
>>>       with tfile to test the tfile memory read.
>>
>>
>> How was this tested?


> ?


$ make check RUNTESTFLAGS="--target_board=native-gdbserver tfile.exp -v"
...
Skipping tfile.exp because of no fileio capabilities.
...

-- 
Pedro Alves


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] add testsuite for for backtrace commands with tfile to test the tfile memory read
  2012-06-22  9:05         ` Pedro Alves
@ 2012-06-24  7:39           ` Hui Zhu
  0 siblings, 0 replies; 8+ messages in thread
From: Hui Zhu @ 2012-06-24  7:39 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Yao Qi, gdb-patches

On Fri, Jun 22, 2012 at 5:05 PM, Pedro Alves <palves@redhat.com> wrote:
> On 06/22/2012 02:42 AM, Hui Zhu wrote:
>
>> On Thu, Jun 21, 2012 at 10:16 PM, Pedro Alves <palves@redhat.com> wrote:
>>> On 06/21/2012 12:15 PM, Hui Zhu wrote:
>>>
>>>>>>
>>>>>> AFAIK, in tfile.exp, trace file is generated by tfile.c and GDB only consumes
>>>>>> these trace files (basic.tf and error.tf) for test purpose.
>>>>>>
>>>> Thanks for your help.
>>>> Post a new version according to your comments.
>>>>
>>>> Thanks,
>>>> Hui
>>>>
>>>> 2012-06-21  Hui Zhu  <hui_zhu@mentor.com>
>>>>
>>>>       * gdb.trace/tfile.exp: Add new test for backtrace commands
>>>>       with tfile to test the tfile memory read.
>>>
>>>
>>> How was this tested?
>
>
>> ?
>
>
> $ make check RUNTESTFLAGS="--target_board=native-gdbserver tfile.exp -v"
> ...
> Skipping tfile.exp because of no fileio capabilities.
> ...
>
> --
> Pedro Alves

This is because:
if [target_info exists gdb,nofileio] {
    verbose "Skipping tfile.exp because of no fileio capabilities."
    continue
}

So to use this test, need remove "set_board_info gdb,do_reload_on_run 1"

Thanks,
Hui


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-06-24  7:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-20 10:09 [PATCH] add testsuite for for backtrace commands with tfile to test the tfile memory read Hui Zhu
2012-06-20 14:19 ` Yao Qi
2012-06-20 14:44 ` Yao Qi
2012-06-21 11:16   ` Hui Zhu
2012-06-21 14:17     ` Pedro Alves
2012-06-22  1:43       ` Hui Zhu
2012-06-22  9:05         ` Pedro Alves
2012-06-24  7:39           ` Hui Zhu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox