From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id s7WFH7fzWmpR6w8AWB0awg (envelope-from ) for ; Fri, 17 Jul 2026 23:32:07 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=MyG99but; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 6956B1E09E; Fri, 17 Jul 2026 23:32:07 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_SBL_CSS autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 8A97B1E099 for ; Fri, 17 Jul 2026 23:32:06 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DFACA4BA2E31 for ; Sat, 18 Jul 2026 03:32:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DFACA4BA2E31 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=MyG99but Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id CD1CE4BA2E17 for ; Sat, 18 Jul 2026 03:31:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CD1CE4BA2E17 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org CD1CE4BA2E17 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1784345501; cv=none; b=oJsBOiVMdvrXBpbG8DlcoNxp+utjXgSw6EbMrLsrNiArdwq+tfGJKEedygjzgqnUgUBOi5YjQrBzYlF712udCjwycXWy1YGQbOpS8vx68R8ABjFlXSTvPYSTFfxmmoO0fKAUNaSjvOZdDfXVXrBNwadrSKRHGifnRCSytY5TdpU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1784345501; c=relaxed/simple; bh=SJRe0UlC9Sa3h/2CJRc1Ni1TmjEUqjdr7LDFFNqoBPE=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=JS297Ng51wtn5RkQw++8p4GcdMmuSgi3uEi31pmqNNvUaXVb+PTWw58wh/LW3uEHL64cLjxIprqU6aQ3KZolrAxUW1/bypRK4SKcnR6H22yhhNWoJ4zUIdWBNYeaLTKI3sL8lm5FFtj0YJ2egtB6ASLSMqKQyrxTgESO7DAnVd8= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=MyG99but DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CD1CE4BA2E17 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1784345500; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=L9UA3RJly7RpE57vRg3riwEyXItuQ7qABPVa3T7CRLU=; b=MyG99butfrpQZ5ObgRPMDHGjPSLQZ11JzldcYe2Fny8g0hXaPu825ddw2jCAnKl12M11Ep mo+cEVwGgiWLyjaPJ9qKRs4BOCnKtu260lj7cfv3gfFQo5K1IUHQuLSSwdR4hhRgRsXkyB JfbudQj9hz3diZYAV5L+kHh3pfXCvTw= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-82-6cshgr5OPVuycFEo6_bnBQ-1; Fri, 17 Jul 2026 23:31:38 -0400 X-MC-Unique: 6cshgr5OPVuycFEo6_bnBQ-1 X-Mimecast-MFC-AGG-ID: 6cshgr5OPVuycFEo6_bnBQ_1784345497 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A1E381955F7C for ; Sat, 18 Jul 2026 03:31:37 +0000 (UTC) Received: from f44-mesa-1 (unknown [10.22.88.58]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 49AE71800603; Sat, 18 Jul 2026 03:31:36 +0000 (UTC) Date: Fri, 17 Jul 2026 20:31:33 -0700 From: Kevin Buettner To: gdb-patches@sourceware.org Cc: Alexandra =?ISO-8859-1?Q?H=E1jkov=E1?= Subject: Re: [PATCH v8] gdb: Add source-tracking breakpoints feature Message-ID: <20260717203133.0b3abbde@f44-mesa-1> In-Reply-To: <20260714094241.178097-1-ahajkova@redhat.com> References: <20260714094241.178097-1-ahajkova@redhat.com> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: r6lJrIvJ1sHt06eaVMNjXlucXKYp4lFuXYlLDAFsqWk_1784345497 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org On Tue, 14 Jul 2026 11:40:52 +0200 Alexandra Hajkova wrote: > +/* Match BREAKPOINT_SRC_CTX_LINES lines of the initially stored source in a > + BREAKPOINT_SRC_CTX_LINES * BREAKPOINT_SRC_SEARCH_MULTIPLIER lines current > + source window. > + > + Returns new breakpoint line on success or -1 on failure. */ > + > +static int > +sliding_window_match (breakpoint_source *bp_source, > + breakpoint_source *tmp_source) > +{ > + /* The index into BP_SOURCE's lines where the breakpoint was placed. */ > + size_t bp_stored = bp_source->bp_line_stored; > + size_t bp_size = bp_source->source_lines.size (); > + > + /* An empty string, used if the breakpoint line is at the start or end of > + the context window. */ > + static std::string empty_string; > + > + /* The lines immediately before and after the breakpoint in BP_SOURCE. > + If the breakpoint is the first or last line in BP_SOURCE then use > + EMPTY_STRING as a stand in. */ > + const std::string &bp_prev > + = (bp_stored == 0 > + ? empty_string : bp_source->source_lines[bp_stored - 1]); > + const std::string &bp_next > + = ((bp_stored + 1) == bp_size > + ? empty_string : bp_source->source_lines[bp_stored + 1]); > + > + /* Now search TMP_SOURCE for the breakpoint line. */ > + size_t tmp_size = tmp_source->source_lines.size (); > + for (size_t i = 0; i < tmp_size; i++) > + { > + if (bp_source->source_lines[bp_stored] == tmp_source->source_lines[i]) > + { > + /* Found the breakpoint line. Capture the lines before and after > + the breakpoint line from TMP_SOURCE. As above, if the > + breakpoint is at the start or end of TMP_SOURCE then use > + EMPTY_STRING as a stand in. */ > + const std::string &tmp_prev > + = (i == 0 ? empty_string : tmp_source->source_lines[i - 1]); > + const std::string &tmp_next > + = ((i + 1) == tmp_size > + ? empty_string : tmp_source->source_lines[i + 1]); > + > + /* If the previous and next lines match then this is the new > + location of the breakpoint, calculate and return the updated > + line number. */ > + if (bp_prev == tmp_prev && bp_next == tmp_next) > + return tmp_source->bp_line + i - tmp_source->bp_line_stored; If BREAKPOINT_SRC_CTX_LINES were changed from 3 to, say, 5 or 7, I don't think that this code will attempt to match all of the lines. It appears to me that it hard codes support for only 3. If the intent is to match the full context window, the algorithm should compare all captured lines, not just the lines before and after the candidate line. If 3-line matching is intentional, the comment or documentation should be updated to clarify that the matching is limited to the breakpoint line and its immediate neighbors, regardless of the BREAKPOINT_SRC_CTX_LINES constant. Kevin