From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 55B093857701 for ; Fri, 28 Apr 2023 23:35:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 55B093857701 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682724951; 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=CwuSY+tYwFVJZTQDp0SHiqqQcHJTBUcGMRZzsuqgcgA=; b=e6fiuauorHMOW5mcZsEIb9fUlw6QG/r5AD55SkUQgzsMYPIbR4eNpsbfaOPtt5WAdM7+jn JfgYlelhhPFolVqwXg3O4NX0bzxO0OrGeaOPtoEBtzv+axLn4Ks4hsMCQcyHqUu0u3vDj7 ZyWWha2N4rxXuZpR+xMUGM0MxpwsJMQ= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-277-pT8pT89yO8mkWW8f30hMkg-1; Fri, 28 Apr 2023 19:35:50 -0400 X-MC-Unique: pT8pT89yO8mkWW8f30hMkg-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-3f187a7a626so756355e9.0 for ; Fri, 28 Apr 2023 16:35:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682724949; x=1685316949; 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=CwuSY+tYwFVJZTQDp0SHiqqQcHJTBUcGMRZzsuqgcgA=; b=XsONIcoErTqYbB8e8S8uiX76PZ06Qz8Y9XxceWgkkGkudLKdGsyIxDNPyguDJfXhJ3 NHb+Hsy5CbRQuGUCoT/QoQSFqnqEMjwabcIpBs3LIq1CzCU1CWISQY6xZ2uinQyLVnXg JCXDfCSHGdyL8Tm1MWljdq7l40alfmUR18eurLorsaUGcFqZHEHg7tITAag1V0g9XJ1d au/w4V4saag8iUOL0eD8IHSqHhEGfCbA35j9h4/VSSsb4ef1fa2SVqQs2IIYsjB9qUtS S/PhtnHf6AxwdTYxZsD79N8WGJ3b7eEAYImlycs5oD35noBDo0Cbn8wApAPBi+s7gcxM LXUA== X-Gm-Message-State: AC+VfDy+lc2L8hS9lz04uWqmuKhikDEMwMSZ75OHV+9/8Pwd59P8JjHW QJ+IjH61DnJTYAZAY7QiwGqv7othH0ur3zjLo3aUViCJDGa4pfZh55VrnJj55IYoGHKZM+mmjvc CeH84MTruUd3ocjNApxYntWyYbR7fUhPQBYLQlev2//cBlU8WGko/aHhLf4qEOzook1lkBR0AyB obJ6MzxQ== X-Received: by 2002:a1c:f20b:0:b0:3f3:1299:5625 with SMTP id s11-20020a1cf20b000000b003f312995625mr5097806wmc.30.1682724949416; Fri, 28 Apr 2023 16:35:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7K++37QPI2OMleWfCnGam2tb+D0gKfzGVNfOQSjCziaqghp585a71Zyfv3ivLJXPoCVyHpTQ== X-Received: by 2002:a1c:f20b:0:b0:3f3:1299:5625 with SMTP id s11-20020a1cf20b000000b003f312995625mr5097799wmc.30.1682724949081; Fri, 28 Apr 2023 16:35:49 -0700 (PDT) Received: from localhost (11.72.115.87.dyn.plus.net. [87.115.72.11]) by smtp.gmail.com with ESMTPSA id hg7-20020a05600c538700b003f1940fe278sm22165680wmb.7.2023.04.28.16.35.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Apr 2023 16:35:48 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCH 1/9] gdb: create_breakpoint: assert for a valid thread-id Date: Sat, 29 Apr 2023 00:35:37 +0100 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 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,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 List-Id: Add an assert into create_breakpoint (breakpoint.c) that the thread argument is a valid thread-id; either a value greater than zero, or -1 to indicate any thread. The thread is ignored if parse_extra is true though, so take that into account too. There should be no user visible changes after this commit. --- gdb/breakpoint.c | 4 ++++ gdb/breakpoint.h | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 46287da5f87..e6940bc9671 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -9026,6 +9026,10 @@ create_breakpoint (struct gdbarch *gdbarch, gdb_assert (ops != NULL); + /* If PARSE_EXTRA is true then the thread-id will be parsed from + EXTRA_STRING, otherwise, ensure THREAD is valid. */ + gdb_assert (parse_extra || thread == -1 || thread > 0); + /* If extra_string isn't useful, set it to NULL. */ if (extra_string != NULL && *extra_string == '\0') extra_string = NULL; diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index 7c5cf3f2bef..e57dc2523fb 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -1530,6 +1530,12 @@ 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. + If INTERNAL is non-zero, the breakpoint number will be allocated from the internal breakpoint count. -- 2.25.4