From patchwork Sat Dec 2 10:42:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 81182 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C2156386189B for ; Sat, 2 Dec 2023 10:42:45 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 565A5385C6EE for ; Sat, 2 Dec 2023 10:42:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 565A5385C6EE Authentication-Results: sourceware.org; dmarc=pass (p=none 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 565A5385C6EE Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701513752; cv=none; b=pdHaqxbmN2KxC2PfuSnmCT3fJaAst79dgTI1gheXxhTTcdJl6yScvMPKuVXX42lJKU/xkl53tK9/fPED3Q6eiHN1XD5QRXhWsX/M8qiIxzHPchnczhEtfomgd8ob8YO8mpiVvBRWbaI81yCqEBjJZn00/Jot+7EChNaMiaYspn8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701513752; c=relaxed/simple; bh=vYRq5DxflXz7AQRI6v3r5TKvF/5nxlr5jgYn7MTYNNc=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=ppogoFp2rUVKHPOdu8CNwOxCMy/5R70WzeUeHlj0i2Zhqk9SvKiwMXDYQmSksa9AxjEFzlkNlrlwQ/DoaLOhqWqevbDaMDs2IA29TK5bezdTCeNgIU2EpKuwTynFirSNwtHomwCsDSlVvah040U1vJ0bLeXd69XWjbXGG60Aqyc= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701513749; 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=o5/AIe6IgfGk1bAScx0sUsUmF7fcxsa2Y5ukjaO6m/M=; b=bx2LKJWpkdAwNky+e6T6iwmDXE/4MGLy8UjrLYH2r1/kFDqqWTQ4uQBCbelyyXNzfqLegi pV0NCumJ7IbEE+dG9mC0FY06SeAyOzKn6FsFH6ty42uJUG8qBcYEcoNDzKmjtcFtmX8vZD WT0lDiZbuY+39LuiQkHqB3Uo6WniaJw= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-377-SYpA6-OkMWe0MYljh1coWg-1; Sat, 02 Dec 2023 05:42:28 -0500 X-MC-Unique: SYpA6-OkMWe0MYljh1coWg-1 Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-a1848bc49f6so256850266b.3 for ; Sat, 02 Dec 2023 02:42:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701513747; x=1702118547; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=o5/AIe6IgfGk1bAScx0sUsUmF7fcxsa2Y5ukjaO6m/M=; b=P5rG812gCMGQ3qyMigTHAqTbKNz+yqNKllZSSmsT1Dnw569VwPvI4OY47QS3KOwAKE 8vbl+hzygQ36d5vE8B/IJaQmqYWY1HRbLouwAsIGgalxLELyjCEuTQAUlWuW6pnHzIGT rryA8FBpfOUkoBw0m6Z4/KlreGbEXvsx89umZJC2x3fvP87iAv8j4GE/vE1iAXuElk5q d800ScLB0jhHNs2SD9UJ2kXXbRNNNsvtZjx+GFJZzFbBDFdF70WVMSvXZ2JhSsudP3WK DOGexhrTaUocfIm5pwqsaJOAKOstRbf3XprBr84qp7uUapvAsjyIyqRdZIw+N/+z7Viy otaA== X-Gm-Message-State: AOJu0YyEL1oJZPbJOhxZKSowKVddoQP5ovAD0CuXBzGOnj7PE8WYn6fE /bKMu6lVF80W0WPjLcq2GCEROGfmCEPosfrG0Vq/NKs3ZCP0C8EOpwKMeddC5AupCa/k5QFmZ4D Rvkx8BdXcaybhj+GKznAzPHLEwgYFUUeQD6DJm13qi8TPVMRrZPsPwOsEIZoYMCa3slWxKzZv61 himCCK7Q== X-Received: by 2002:a17:906:374c:b0:a19:a1ba:8ccd with SMTP id e12-20020a170906374c00b00a19a1ba8ccdmr1443712ejc.107.1701513746800; Sat, 02 Dec 2023 02:42:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IHMQ7se0jqzPxy8zXhUjj3s53AXVYROv0ZYBZn2tIxaBvfH1EYpex12Qt49/5nzLudr1vOBbg== X-Received: by 2002:a17:906:374c:b0:a19:a1ba:8ccd with SMTP id e12-20020a170906374c00b00a19a1ba8ccdmr1443708ejc.107.1701513746532; Sat, 02 Dec 2023 02:42:26 -0800 (PST) Received: from localhost (92.40.184.5.threembb.co.uk. [92.40.184.5]) by smtp.gmail.com with ESMTPSA id e19-20020a17090681d300b009fcb5fcfbe6sm2901018ejx.220.2023.12.02.02.42.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Dec 2023 02:42:25 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCHv6 01/10] gdb: create_breakpoint: add asserts and additional comments Date: Sat, 2 Dec 2023 10:42:09 +0000 Message-Id: X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_ABUSEAT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, RCVD_IN_SBL_CSS, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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+patchwork=sourceware.org@sourceware.org This commit extends the asserts on create_breakpoint (in the header file), and adds some additional assertions into the definition. The new assert confirms that when the thread and inferior information is going to be parsed from the extra_string, then the thread and inferior arguments should be -1. That is, the caller of create_breakpoint should not try to create a thread/inferior specific breakpoint by *both* specifying thread/inferior *and* asking to parse the extra_string, it's one or the other. There should be no user visible changes after this commit. --- gdb/breakpoint.c | 6 ++++++ gdb/breakpoint.h | 16 ++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 699919e32b3..dd415ff42f0 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -9228,6 +9228,12 @@ create_breakpoint (struct gdbarch *gdbarch, gdb_assert (inferior == -1 || inferior > 0); gdb_assert (thread == -1 || inferior == -1); + /* If PARSE_EXTRA is true then the thread and inferior details will be + parsed from the EXTRA_STRING, the THREAD and INFERIOR arguments + should be -1. */ + gdb_assert (!parse_extra || thread == -1); + gdb_assert (!parse_extra || inferior == -1); + gdb_assert (ops != NULL); /* If extra_string isn't useful, set it to NULL. */ diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index feb798224c0..4abf6d0762c 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -1600,6 +1600,22 @@ enum breakpoint_create_flags the FORCE_CONDITION parameter is ignored and the corresponding argument is parsed from EXTRA_STRING. + The THREAD should be a global thread number, the created breakpoint will + only apply for that thread. If the breakpoint should apply for all + threads then pass -1. However, if PARSE_EXTRA is non-zero then the + THREAD parameter is ignored and an optional thread number will be parsed + from EXTRA_STRING. + + The INFERIOR should be a global inferior number, the created breakpoint + will only apply for that inferior. If the breakpoint should apply for + all inferiors then pass -1. However, if PARSE_EXTRA is non-zero then + the INFERIOR parameter is ignored and an optional inferior number will + be parsed from EXTRA_STRING. + + At most one of THREAD and INFERIOR should be set to a value other than + -1; breakpoints can be thread specific, or inferior specific, but not + both. + If INTERNAL is non-zero, the breakpoint number will be allocated from the internal breakpoint count.