[patch] circ.exp

Abid, Hafiz hafiz_abid@mentor.com
Wed May 8 10:12:00 GMT 2013


Hi Pedro,
Thanks for your review. Here is an updated patch.

> s/size buffer size/buffer size/
Fixed.

> > +if [gdb_test "tstatus" ".*Trace buffer is circular.*" \
> > +    "circular buffer is supported"] {
> > +	unsupported "target does not support circular trace buffer"
> 
> This issues a FAIL in the unsupported case.  We need to instead
> use gdb_test_multiple to prevent that.  E.g.,
> 
> set circular_supported -1
> set test "check whether circular buffer is supported"
> gdb_test_multiple "tstatus" $test {
>   -re ".*Trace buffer is circular.*$gdb_prompt $" {
>      pass $test
>   }
>   -re "$gdb_prompt $" {
>      pass $test
>   }
> }
I have used similar code sequence as you described above. But I was  
wondering if we can
issue an unsupported call in the 2nd '-re' and then return. That should  
eliminate the need
for 'circular_supported'. It also generates an extra pass while we then  
call unsupported below.
> 
> if { $circular_supported < 0 } {
>     unsupported "target does not support circular trace buffer"
>     return 1
> }
> 
> Please disable circular tracing support in your gdbserver (e.g.,
> hack handle_tracepoint_general_set) and make sure the file
> tests without FAILs.

Fixed. I tested by disabling the support of the packet in gdbserver as  
you suggested.
I noticed that when support was disabled, then 'set  
circular-trace-buffer on'
gives 'Target does not support this command' error.
I modified the test a bit to handle that error. Similar case with
'set trace-buffer-size' when support for QTBuffer:size is disabled.

> 
> Likewise, disable buffer size support, and make sure this doesn't
> issue a FAIL.
> 
Done.

> 
> Likewise.
> 
Done.

> 
> "Set a single tracepoint, " ... "using the tstatus command".
> 
Fixed.

> 
> s/frame 0/the first frame/
> 
Fixed.

> Sorry, this isn't right yet.  The number space of tracepoints is
> shared with breakpoints.  It didn't used to be that way up until a  
> couple of
> years ago.  So the tracepoint at func9 is not actually tracepoint 9  
> -- it
> depends on the number of breakpoints the test has setup before  
> creating
> the tracepoints.
> 
> (gdb) PASS: gdb.trace/circ.exp: show circular-trace-buffer (off)
> trace func0
> Tracepoint 2 at 0x400540: file  
> ../../../src/gdb/testsuite/gdb.trace/circ.c, line 28.
> (gdb) PASS: gdb.trace/circ.exp: frame size: set tracepoint at func0
> ...
> (gdb) PASS: gdb.trace/circ.exp: normal buffer: set actions for func8
> trace func9
> Tracepoint 11 at 0x400576: file  
> ../../../src/gdb/testsuite/gdb.trace/circ.c, line 64.
> (gdb) PASS: gdb.trace/circ.exp: normal buffer: set tracepoint at func9
> 
> Hardcoding a number is fragile.  The test may change in the future,  
> or the
> dejagnu board file itself may create breakpoints.  We could either
> ask GDB for the tracepoint number (it's in $tpnum), or
> use "tfind pc func9".
I am using "tfind pc func9" now. It also forced me to put the  
tracepoints
using 'trace *func9' in 'set_a_tracepoint' so that tracepoint address  
matches
here.

> 
> s/frame zero/somethingelse/.  "that a frame for func0"
> 
Fixed.

> 
> likewise for frame nine.
> 
Fixed.


> > +# 1) frame zero will be overwritten and therefore unavailable
> 
> "frame zero" here.
> 
Fixed.

> > -# Finished!
> > -gdb_test "tfind none" ".*" ""
> > +    # Frame 0 should not be at func0
> 
> First frame.
> 
Fixed.

> > +    gdb_test "tfind start" ".*#0  func\[1-9\] .*" \
> > +	"first frame is NOT at func0";
> > +
> > +    gdb_test "tfind none" ".*"
> > +
> > +    gdb_test \
> > +	"tfind tracepoint 9" ".*Found trace frame $decimal, tracepoint  
> 9.*" \
> > +	"find frame for tracepoint nine"
> > +}

Thanks,
Abid

gdb/testsuite/ChangeLog:
2013-05-08  Hafiz Abid Qadeer  <abidh@codesourcery.com>

	* gdb.trace/circ.exp: Remove unnecessary 'if then' checks.
	(set_a_tracepoint): Set tracepoint before prologue.
	(run_trace_experiment): Test setup_tracepoints and 'break end'
	in it.
	(trace_buffer_normal): Remove.
	(gdb_trace_circular_tests): Remove.  Move tests to...
	(top level): ...here.  Call 'runto_main' before checking for
	trace support.  Use commands to check the support for circular
	trace buffer and changing of trace buffer size.  Add test
	to calculate size of single frame.  Use this size to
	calculate the size of trace buffer.  Use 'tfind pc func9'
	instead of 'tfind 9'.  Use 'with_test_prefix'.





-------------- next part --------------
A non-text attachment was scrubbed...
Name: circ_v4.patch
Type: text/x-patch
Size: 13876 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20130508/b450c0b3/attachment.bin>


More information about the Gdb-patches mailing list