From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3621 invoked by alias); 14 Nov 2016 09:47:15 -0000 Mailing-List: contact gdb-testers-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-testers-owner@sourceware.org Received: (qmail 3581 invoked by uid 89); 14 Nov 2016 09:47:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.5 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1382 X-HELO: kwanyin.sergiodj.net Received: from kwanyin.sergiodj.net (HELO kwanyin.sergiodj.net) (176.31.208.32) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 14 Nov 2016 09:47:04 +0000 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [binutils-gdb] btrace: read entire aux buffer From: sergiodj+buildbot@sergiodj.net To: gdb-testers@sourceware.org Message-Id: Date: Mon, 14 Nov 2016 10:28:00 -0000 X-SW-Source: 2016-q4/txt/msg02977.txt.bz2 *** TEST RESULTS FOR COMMIT db58b3735f45345c06cb9a14d0f83f5b26c1ebf3 *** Author: Markus Metzger Branch: master Commit: db58b3735f45345c06cb9a14d0f83f5b26c1ebf3 btrace: read entire aux buffer The data_head of a perf event data buffer grows indefinitely. Users are expected to compute data_head % data_size to find the location inside the perf event data buffer. The aux_head of a perf event aux buffer wraps around and always stays within the perf event aux buffer. Well, at least that's the behaviour for BTS and PT - where BTS uses the data buffer and PT the aux buffer. GDB does not read beyond data_head or aux_head. This is OK for BTS but wrong for PT. It causes only a portion of the trace to be considered by GDB. In the extreme case, the buffer may appear (almost) empty. Thanks to Tim Wiederhake for reporting the anomaly. Change it to read the entire aux buffer for PT. The buffer is initially zero so any extra zeroes we read before aux_head wraps around the first time will be ignored when searching for the first PSB packet in order to synchronize onto the trace stream. gdb/ * nat/linux-btrace.c (perf_event_read): Allow data_head < size. * nat/linux-btrace.c (perf_event_read_all): Do not adjust size. Change-Id: If4f8049a2080a5f16f336309450b32a3eb1e3ec9