From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 6QuGISQlaWmxDgUAWB0awg (envelope-from ) for ; Thu, 15 Jan 2026 12:34:28 -0500 Authentication-Results: simark.ca; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=lkoKAOk2; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 839D61E0E1; Thu, 15 Jan 2026 12:34:28 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.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 20EDE1E070 for ; Thu, 15 Jan 2026 12:34:28 -0500 (EST) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 9F3DE4BA2E35 for ; Thu, 15 Jan 2026 17:34:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9F3DE4BA2E35 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=lkoKAOk2 Received: from mail-ot1-x32b.google.com (mail-ot1-x32b.google.com [IPv6:2607:f8b0:4864:20::32b]) by sourceware.org (Postfix) with ESMTPS id 5DF5E4BA2E20 for ; Thu, 15 Jan 2026 17:33:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5DF5E4BA2E20 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5DF5E4BA2E20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::32b ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1768498403; cv=none; b=YEJ3IdQLGx89iGFpWIn7s+OnpiKNqcBWQa966EvTT7lfFxHdYKCnzCOp4Qk6XP531WGmFNXF3JmBhT8oyv8HSKVj0mGRZgVhAkoZY8ypykXDix1ILGlR7ktDHwqx1JaqnOCNfxXwlwlqsM58NrbVeoKAKdrMET94Lq9+yc1SIK0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1768498403; c=relaxed/simple; bh=qgoNTSW4Wx2dNeacjeIYA6K67Mu1ndzt4IvmiVAISRw=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=JuVo03ZXGBa7x26kF1Ggimc42qmbX3h9U1kQqiIjFeAPIA2QMNRRAtjZkFXdpwc2AeibZBdOao3JOJR3MRZxN/B3C4r6i9zpVgbsKM7Qy+HiowR4k2tj9irA88FUgXbaRd+TypJRBMLPSiNxV7cyE57Ua5zYaNiMqP5WcNFmZQE= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5DF5E4BA2E20 Received: by mail-ot1-x32b.google.com with SMTP id 46e09a7af769-7cfd04f1be8so477274a34.2 for ; Thu, 15 Jan 2026 09:33:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1768498403; x=1769103203; darn=sourceware.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=0BYYX0UGacrBsJx/KASrmzHkCRq9JD+Xyqrl7BZW36A=; b=lkoKAOk2kHwE7n0lgyIbegX1UvQoglflQQJsTiQI3YLk8VWIRVFKDah5lgTcFXiwEk Sz3EquaDFAVeofvlaugz6xebE2TxW5ZXzQQqehs/Km3Drx1ZzJKT5UiNj3SAL2W9Plji z3RU4kBChN1kdBww9oNDJlzayOSSkvmxqjNc75Tf3+ndIQJO6OU3nebXLGv0BqYBn5VE Im0daIOPrA83Q0zcS2O5+2efLCCbMDDlpNj5J/IgC9R5UKWRMPJu/SUTMFeJMjmLH0bJ 7furhpoEsuXt72ni75HeB988RmN//h1cUSuqZXqb2kfw7Lms7X/m9W2Zz4sy+K2xZu97 Fx4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768498403; x=1769103203; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=0BYYX0UGacrBsJx/KASrmzHkCRq9JD+Xyqrl7BZW36A=; b=fbFUANVbVF86X1wUwZebBFkKCwzyiYHjND5cDTHHX4bszJ0hKbJxW9Pp3rpZurftTq fy880NMsA4T6Z3aaN8gMZKn6YsGr8HiwnH6QEl9fGpB/fHmRJZ70ZXE5vqMpmqRL9XWJ YZGnXkwMQ3m/8XZMLCoPEoi56RwgEyorK3gIsEulOA9VXA8dVLetFoYsU3jMUZkxiePp /+C2Y1G68JRK6ZwOG3Kq79/19Vg+YzkmzH59oXQfuFe4+UzuCxMhwJe9R807P44YDG1V JxofMPnIrJVJML/MBpfc8L1GfWrXn8B41JHXmrpsixJqjHAL+7XhYwl6NXajTY3ZrDIM sgcA== X-Gm-Message-State: AOJu0Yw+QKdXUm1X4+7+Xa9s+2B9fsK2pgtArJs0Z38ZRddMFV5Lox6s U5wR8jgVFXEE75yR1Qp7RsoUhX9eQzHwtXpusViGWFdOuhrnxZ3LquPWgQs/VUatJg== X-Gm-Gg: AY/fxX5v2KorT3sZPKsj9hiyiIJW6IVe2KANFrTk3aEPHSlUNT3K/iH0r8oSxY7BuLu LIuH5QR98L8JDwzn7PSbU+htJGpnjcfgXApL+xVtR030iSEzCrU2bo0SiSnu8/uC3V0cbpNcB/h zE2OKYWqBfXif0izUabRPGbrwuGh9bEKf4uH4V/bok5BpFhf488ifqnbm3pOrPGokmGjSfgGaa2 3e/OfPELr7/A+l73R1x4joKpl71pQ2wOZYhVfpV/7ol6gDKw36T4/Nbbh/ks65HrYUyNFeFXKEz f4LtB8am1t6EqFbUpgxfffHFZDa3Ut6WccaI1fud7BaL+KkpYbJ1eGs282Fiqzh60V9PH9h018Z BLVkM+zqRThD1kAJazjOfbYDucZn5pNWxm+u6E1ZJzS+4IrEh6NFQLYkz+fgN+nCwDoL7r16tQ0 GzJKLSTscwyRAYNZeoo0P2548B75fbY2EjUkDlR3XkKg== X-Received: by 2002:a05:6830:3152:b0:7cf:cf19:cc62 with SMTP id 46e09a7af769-7cfdeec604emr127628a34.38.1768498402730; Thu, 15 Jan 2026 09:33:22 -0800 (PST) Received: from [192.168.0.26] (97-122-114-32.hlrn.qwest.net. [97.122.114.32]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7cfdf0e92d3sm67743a34.9.2026.01.15.09.33.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Jan 2026 09:33:22 -0800 (PST) From: Tom Tromey Date: Thu, 15 Jan 2026 10:33:19 -0700 Subject: [PATCH 2/2] Use make_unique_xstrdup in tracepoint MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260115-xstrdup-v1-2-72e13ba99851@adacore.com> References: <20260115-xstrdup-v1-0-72e13ba99851@adacore.com> In-Reply-To: <20260115-xstrdup-v1-0-72e13ba99851@adacore.com> To: gdb-patches@sourceware.org Cc: Tom Tromey X-Mailer: b4 0.14.3 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 This changes the tracepoint code to use make_unique_xstrdup (and make_unique_xstrndup). This meant changing the types of some members of uploaded_tp -- but it seems to me that using array types there did not add any value. --- gdb/tracepoint.c | 10 ++++------ gdb/tracepoint.h | 12 ++++++------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index a70edaeb262..2b6fbcbf5ae 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -3414,7 +3414,7 @@ parse_tracepoint_definition (const char *line, struct uploaded_tp **utpp) p++; /* skip a colon */ if (piece == 'T') { - gdb::unique_xmalloc_ptr cond; + gdb::unique_xmalloc_ptr cond; enabled = (*p++ == 'E'); p++; /* skip a colon */ @@ -3442,9 +3442,7 @@ parse_tracepoint_definition (const char *line, struct uploaded_tp **utpp) p++; p = unpack_varlen_hex (p, &xlen); p++; /* skip a comma */ - cond.reset ((char *) xmalloc (2 * xlen + 1)); - strncpy (&cond[0], p, 2 * xlen); - cond[2 * xlen] = '\0'; + cond = make_unique_xstrndup (p, 2 * xlen); p += 2 * xlen; } else @@ -3486,9 +3484,9 @@ parse_tracepoint_definition (const char *line, struct uploaded_tp **utpp) buf[end] = '\0'; if (startswith (srctype, "at:")) - utp->at_string.reset (xstrdup (buf)); + utp->at_string = make_unique_xstrdup (buf); else if (startswith (srctype, "cond:")) - utp->cond_string.reset (xstrdup (buf)); + utp->cond_string = make_unique_xstrdup (buf); else if (startswith (srctype, "cmd:")) utp->cmd_strings.emplace_back (xstrdup (buf)); } diff --git a/gdb/tracepoint.h b/gdb/tracepoint.h index 8503789a14b..247723aa7ee 100644 --- a/gdb/tracepoint.h +++ b/gdb/tracepoint.h @@ -177,21 +177,21 @@ struct uploaded_tp int orig_size = 0; /* String that is the encoded form of the tracepoint's condition. */ - gdb::unique_xmalloc_ptr cond; + gdb::unique_xmalloc_ptr cond; /* Vectors of strings that are the encoded forms of a tracepoint's actions. */ - std::vector> actions; - std::vector> step_actions; + std::vector> actions; + std::vector> step_actions; /* The original string defining the location of the tracepoint. */ - gdb::unique_xmalloc_ptr at_string; + gdb::unique_xmalloc_ptr at_string; /* The original string defining the tracepoint's condition. */ - gdb::unique_xmalloc_ptr cond_string; + gdb::unique_xmalloc_ptr cond_string; /* List of original strings defining the tracepoint's actions. */ - std::vector> cmd_strings; + std::vector> cmd_strings; /* The tracepoint's current hit count. */ int hit_count = 0; -- 2.52.0