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.133.124]) by sourceware.org (Postfix) with ESMTPS id 99C173858C66 for ; Sun, 31 Mar 2024 10:27:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 99C173858C66 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 99C173858C66 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711880823; cv=none; b=Vevzj40yWcn21Nwwl1coIxW2qte2SO73kE5JSQvD09pKQw1g5KKXqw/xsTTGn9kbYidhl7Qh0obLCnP9InPfHT8LMuzmCljh/lK2bpDoueqOSMfQ+AMC99b8IoQv/0V1h5+wDAk8m0u4Ehp7OB35TE4TdqUk5HWSl93zttyskOQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711880823; c=relaxed/simple; bh=5uIoyLaoy+LR6p2D//G9R42isuqYQWeiz796/QGACtw=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=aV6lCzLGxl7LUW8qxrr2Hn9vfbel5+4PhDJGmaX0zsjcB5ScwBE4uv3LiCZyj0IlWj6AYBg0W9iuh8wMac71irHBlA7sTOuE22B32MTRPxtHqbUpjoaI1e2WLTJ0OpV8/UURZuqHXclaA2sp5jZh2NDdlAzTmgP1GeEA5DK3RB0= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711880821; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=0R40nBBErgjURmAHKz31w8fcJgKDwm5lecyaYdPFoyg=; b=c3C05cmH/kZ5G6FxVmPrbCA6UtRZaxzBsdCrdia6OQSERqJ4PylOqFSZGsraLyFW3rx/Wp kWeFnEelURD4Eskw5gIjfAletfCer5yOblVHD/+FRxQ6xgJQ9yyrmkKb/jOgTEIZxie944 ZuW5YuisrWon4PzB5Kmc9+h7XiT0o7s= 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-414-VSm227RrO8WJzmUNWx3x2A-1; Sun, 31 Mar 2024 06:26:59 -0400 X-MC-Unique: VSm227RrO8WJzmUNWx3x2A-1 Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-56dbeb46016so915810a12.0 for ; Sun, 31 Mar 2024 03:26:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711880818; x=1712485618; h=mime-version:message-id:date:references:in-reply-to:subject:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=0R40nBBErgjURmAHKz31w8fcJgKDwm5lecyaYdPFoyg=; b=EzmD+26nsWDg7tqK+y/G/SkGQ9fjzz+eJbTh2BpHcNnN2TVxY0qO3DchLuSVh9Q4Az C+Ljo1iBfM52Defh5iEshRYCbyRp7VvCY61cgIxHPJXt3A4zJx6F+DcagiqUZiNkfOcQ b052duq+H7PlTAptvzHIdP+GkPu2PiQ1xOPcZlMDRiuY+O5JwjtJzPKEaUQ7GSa6dz7g ey1lmUJT/29IdKwGoObv39d2lx5Ga6gwSRtrWKyk832JOaKahEylZFJClJUUFN0lDwUQ 4CikrOIeUlCkxdxGZErPQQ1gdxPs57w1gf7IzUetjJhqZI/kaTXUX7lJBKe+DPulHN01 CEag== X-Gm-Message-State: AOJu0YwqEnHGecuKqFCfYfhNZnXgSEhZJU0PS70QNXwRXdZ//OEzKHEV vt2cwTZLYmdn8FBsI1bSnCG5X0n5BGpIa7GfZFYCafUlH9u/5vFIbtdYIgh0RwMUxG1p/on9X/g FispHUqUlzNZJhnxVKiMR3aXMLbZZlyM73fqa9vDqYuZt6FYwh75vzEzW3QBl9cGdybQhqfI+FP zMXx0A/t2fSW6O0BUG3cuY5YDogqInGv3Vf3LhMGWcNgU= X-Received: by 2002:a50:d6cb:0:b0:56d:c711:1538 with SMTP id l11-20020a50d6cb000000b0056dc7111538mr1979068edj.18.1711880817756; Sun, 31 Mar 2024 03:26:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFyxyjzaF5nBkGFsif245HinQruVYgmMJmsD2Jq+kcQ22b3k3esBpMBk6LxTj0i/6Er8ngUGA== X-Received: by 2002:a50:d6cb:0:b0:56d:c711:1538 with SMTP id l11-20020a50d6cb000000b0056dc7111538mr1979061edj.18.1711880817319; Sun, 31 Mar 2024 03:26:57 -0700 (PDT) Received: from localhost (185.223.159.143.dyn.plus.net. [143.159.223.185]) by smtp.gmail.com with ESMTPSA id f4-20020a056402194400b0056c4cdc987esm4218984edz.8.2024.03.31.03.26.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Mar 2024 03:26:57 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Subject: Re: [PATCHv9 02/14] gdb: create_breakpoint: asserts relating to extra_string/parse_extra In-Reply-To: <9ac1de66c5a14db651f923818b39e9e7544c6778.1709651994.git.aburgess@redhat.com> References: <9ac1de66c5a14db651f923818b39e9e7544c6778.1709651994.git.aburgess@redhat.com> Date: Sun, 31 Mar 2024 11:26:56 +0100 Message-ID: <87edbq4ryn.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-6.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP 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: Andrew Burgess writes: > The goal of this commit is to better define the API for > create_breakpoint especially around the use of extra_string and > parse_extra. This will be useful in the next commit when I plan to > make some changes to create_breakpoint. > > This commit makes one possibly breaking change: until this commit it > was possible to create thread-specific dprintf breakpoint like this: > > (gdb) dprintf call_me, thread 1 "%s", "hello" > Dprintf 2 at 0x401152: file /tmp/hello.c, line 8. > (gdb) info breakpoints > Num Type Disp Enb Address What > 2 dprintf keep y 0x0000000000401152 in call_me at /tmp/hello.c:8 thread 1 > stop only in thread 1 > printf "%s", "hello" > (gdb) > > This feature of dprintf was not documented, was not tested, and is > slightly different in syntax to how we create thread specific > breakpoints and/or watchpoints -- the thread condition appears after > the first ','. > > I believe that this worked at all was simply by luck. We happen to > pass the parse_extra flag as true from dprintf_command to > create_breakpoint. > > So in this commit I made the choice change this. We now pass > parse_extra as false from dprintf_command to create_breakpoint. With > this done it is assumed that the only thing in the extra_string is the > dprintf format and arguments. > > Beyond this change I've updated the comment on create_breakpoint in > breakpoint.h, and I've then added some asserts into > create_breakpoint as well as moving around some of the error > handling. > > - We now assert on the incoming argument values, > > - I've moved an error check to sit after the call to > find_condition_and_thread_for_sals, this ensures the extra_string > was parsed correctly, > > In dprintf_command: > > - We now throw an error if there is no format string after the > dprintf location. This error was already being thrown, but was > being caught later in the process. With this change we catch the > missing string earlier, > > - And, as mentioned earlier, we pass parse_extra as false when > calling create_breakpoint, > > In create_tracepoint_from_upload: > > - We now throw an error if the parsed location doesn't completely > consume the addr_str variable. This error has now effectively > moved out of create_breakpoint. I've gone ahead and committed this patch. Thanks, Andrew