gdb: Fix gdb.python/py-record-btrace.exp test
My previous patch commit 8958aefd (HEAD) Author: Felix Willgerodt <felix.willgerodt@intel.com> Date: Mon Feb 25 15:30:29 2019 +0100 python: Add clear() to gdb.Record. exposed a clear function for btrace data in python and added some tests for it. That caused a regression (PR 32086) when recording with bts. This is reproducible even without my patch, when adding "maintenance btrace clear" to the test. When comparing the instructions that get recorded in both cases, the traces are almost identical, just that the first 3 instructions are missing. Before clear: (gdb) record instruction-history 1,100 1 0x0000555555555163 <main+12>: movl $0x0,-0x4(%rbp) 2 0x000055555555516a <main+19>: movl $0x0,-0x8(%rbp) 3 0x0000555555555171 <main+26>: jmp 0x555555555184 <main+45> 4 0x0000555555555184 <main+45>: cmpl $0x63,-0x4(%rbp) 5 0x0000555555555188 <main+49>: jle 0x555555555173 <main+28> 6 0x0000555555555173 <main+28>: mov -0x8(%rbp),%eax 7 0x0000555555555176 <main+31>: mov %eax,%edi ... After clear: (gdb) record instruction-history 1,100 1 0x0000555555555184 <main+45>: cmpl $0x63,-0x4(%rbp) 2 0x0000555555555188 <main+49>: jle 0x555555555173 <main+28> 3 0x0000555555555173 <main+28>: mov -0x8(%rbp),%eax 4 0x0000555555555176 <main+31>: mov %eax,%edi ... The GDB manual describes this behaviour already: maint btrace clear Discard the branch trace data. The data will be fetched anew and the branch trace will be recomputed when needed. This implicitly truncates the branch trace to a single branch trace buffer. When updating branch trace incrementally, the branch trace available to GDB may be bigger than a single branch trace buffer. The test with BTS is updating the recorded trace incrementally. After the clear, the buffer of raw trace data available is not enough to recompute the whole trace as it was before the clear(), and the first 3 instructions are missing. As increasing the buffer size for BTS didn't help, I propose to fix the test by moving the testing of clear to the end of the test. Approved-By:Tom de Vries <tdevries@suse.de> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32086
Loading
Please register or sign in to comment