Message ID | 1b59bf3286719bd63e4cc9caaf66e977fdf49e64.1709651994.git.aburgess@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> 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 C17F038582A5 for <patchwork@sourceware.org>; Tue, 5 Mar 2024 15:22:47 +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 78EB338582A0 for <gdb-patches@sourceware.org>; Tue, 5 Mar 2024 15:21:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 78EB338582A0 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 78EB338582A0 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=1709652119; cv=none; b=xWmI2C7ebv9SakdCkfHeUmGkJtso03Hu1YZDB2voNJO9YE/RnQnTGlO8g4+fyi/YXxxyUIBGobiG/WiRtj7Ti4cCzY/T4pi1Czj3Q0aS529WxrvkJnfwAeyvQHTIFMsKKtkI6KP99vCpzzaH9TXakcdPBc8NhqTbNZtej07n/eA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709652119; c=relaxed/simple; bh=KxDyChrRp/VZxzH6Kp6BlpiFsVevvEXSmlPYPX/Tyq4=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=aJH70ujrtykJLBdjBmJeNvhLcMGdFjVtdzUddHRdFX16Yx8+yoa/xaTqscbS0LrWu92fGZZ0dO8uUQjusQxF4JNPWaPpYfGMttsOCfhndGt+9D2krlqSsYLWwzJbXdczePVM7dj14vSEXFVXgEpF94nlTdFhITFXelObyTKTr2U= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709652118; 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=wJYGLkoaSFoYHvKvxPcDIiUE0RfkiitqxVfmalZToiQ=; b=RNDyOPk8AZVniK9xzKTBF7WW3ZvvkBTB1UZKfVDzNlvlr/WTklZrJLruDMF4QZsOZAD5dI o2AerEOGePzMtIfR7/E3LUHGlvy6gjFCH4afqpBfngNMayGk43afY0bs7tswkqqfFUpxuw owInecuGA4/3S285xYCQazHVWWsEZq8= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-139-jl5KywKDP3qoFNwS3dh0aw-1; Tue, 05 Mar 2024 10:21:56 -0500 X-MC-Unique: jl5KywKDP3qoFNwS3dh0aw-1 Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-55d71ec6ef3so5441540a12.0 for <gdb-patches@sourceware.org>; Tue, 05 Mar 2024 07:21:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709652114; x=1710256914; 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=wJYGLkoaSFoYHvKvxPcDIiUE0RfkiitqxVfmalZToiQ=; b=jfImYQ3HLKC9WIx/EuQBXafpMMZfOTm9mGNTuSTMBHXW6d5tP+7PEQfwmbJXYlfPB/ 5wVprb3FGHA6Iu6NBKORVwWZMxUHmIkul96aPNZLF/CYjAE2HhH9j3lTbdLl/xKrEw5z MFkgardIMEE+vFhzBw/B233JYSeaMHs9RJRtHwdAsIK3lBr5H/HiTq5WrMPQ2EHj3P9N 5BGwCZth6qE53BX7Z63082z7V0RO0w9Kn8QcqUqoTSJp9hopUqnLz5iWpfq3+0Iuk0xV A2KpkBGypPyUnUAtuECZ1Zd54mpq6/nafH9vg6wyaM2Ji+54xK7/h4SiiXFuTHbmaQYj h/MQ== X-Gm-Message-State: AOJu0YzpU2Ic8+sR4l876YEhrrZS3GAxecdyRdgXIT4vHTLDiUNQEQeB boLBzbLGnzJnjuu/6ON/bVkf0GfmLvQZtu9tiBscQ9AHHhG7/W2DSTB+M59pkq1TsnsmmVECXkE TBABgGPmO4XFcphk+uwABd888tUZhJ+eDZBgSAsEGRpox2BVTitFdHh6srJXUe2mhpxOXIbNKHB 91r/f2yKuy7PhczDwxitMrxeqvRClZHrE9UAf1NX6Vz5w= X-Received: by 2002:a05:6402:222a:b0:566:2a20:fc20 with SMTP id cr10-20020a056402222a00b005662a20fc20mr8897731edb.9.1709652114053; Tue, 05 Mar 2024 07:21:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IHRSBTnbp9n/+g0Xlf7yknwgQmMh1Szv8HmFnBwkb71WWelTAU6Rn/bMSIgvqWXWeoEVVgRmQ== X-Received: by 2002:a05:6402:222a:b0:566:2a20:fc20 with SMTP id cr10-20020a056402222a00b005662a20fc20mr8897714edb.9.1709652113639; Tue, 05 Mar 2024 07:21:53 -0800 (PST) Received: from localhost (185.223.159.143.dyn.plus.net. [143.159.223.185]) by smtp.gmail.com with ESMTPSA id r18-20020aa7cb92000000b005653c441a20sm5916033edt.34.2024.03.05.07.21.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 07:21:53 -0800 (PST) From: Andrew Burgess <aburgess@redhat.com> To: gdb-patches@sourceware.org Cc: Andrew Burgess <aburgess@redhat.com> Subject: [PATCHv9 03/14] gdb: change 'if' to gdb_assert in update_dprintf_command_list Date: Tue, 5 Mar 2024 15:21:34 +0000 Message-Id: <1b59bf3286719bd63e4cc9caaf66e977fdf49e64.1709651994.git.aburgess@redhat.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <cover.1709651994.git.aburgess@redhat.com> References: <cover.1703841366.git.aburgess@redhat.com> <cover.1709651994.git.aburgess@redhat.com> 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=-12.3 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, 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 <gdb-patches.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=subscribe> Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org |
Series |
thread-specific breakpoints in just some inferiors
|
|
Checks
Context | Check | Description |
---|---|---|
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 | success | Testing passed |
linaro-tcwg-bot/tcwg_gdb_build--master-arm | success | Testing passed |
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 | success | Testing passed |
linaro-tcwg-bot/tcwg_gdb_check--master-arm | success | Testing passed |
Commit Message
Andrew Burgess
March 5, 2024, 3:21 p.m. UTC
I noticed in update_dprintf_command_list that we handle the case where the bp_dprintf style breakpoint doesn't have a format and args string. However, I don't believe such a situation is possible. The obvious approach certainly already catches this case: (gdb) dprintf main Format string required If it is possible to create a dprintf breakpoint without a format and args string then I think we should be catching this case and handling it at creation time, rather than having GDB just ignore the situation later on. And so, I propose that we change the 'if' that ignores the case where the format/args string is empty, and instead assert that we do always have a format/args string. The original code, that handled an empty format/args string has existed since commit e7e0cddfb0d4, which is when dprintf support was added to GDB. If I'm correct and this situation can't ever happen then there should be no user visible changes after this commit. --- gdb/breakpoint.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
Comments
Andrew Burgess <aburgess@redhat.com> writes: > I noticed in update_dprintf_command_list that we handle the case where > the bp_dprintf style breakpoint doesn't have a format and args string. > > However, I don't believe such a situation is possible. The obvious > approach certainly already catches this case: > > (gdb) dprintf main > Format string required > > If it is possible to create a dprintf breakpoint without a format and > args string then I think we should be catching this case and handling > it at creation time, rather than having GDB just ignore the situation > later on. > > And so, I propose that we change the 'if' that ignores the case where > the format/args string is empty, and instead assert that we do always > have a format/args string. The original code, that handled an empty > format/args string has existed since commit e7e0cddfb0d4, which is > when dprintf support was added to GDB. > > If I'm correct and this situation can't ever happen then there should > be no user visible changes after this commit. I've gone ahead and committed this patch. Thanks, Andrew
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 0482064d057..a7b516ab26c 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -8528,8 +8528,9 @@ update_dprintf_command_list (struct breakpoint *b) const char *dprintf_args = b->extra_string.get (); gdb::unique_xmalloc_ptr<char> printf_line = nullptr; - if (!dprintf_args) - return; + /* Trying to create a dprintf breakpoint without a format and args + string should be detected at creation time. */ + gdb_assert (dprintf_args != nullptr); dprintf_args = skip_spaces (dprintf_args);