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 57E92385840D for ; Tue, 23 Apr 2024 20:04:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 57E92385840D 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 57E92385840D 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=1713902695; cv=none; b=Q8+9OMin5TH65tlbpG+ctteq379ciKlLFAfIT+k8srztOMiSLNxfO3a+e7RajiwK856GU/cYLebD632ztriXyy+dC/PVf3NtqBLDqZTNZgv4g+rDKaNScWf7C106myQgf3qWOW6OyNZCWo2GjX/KAYjt/55d70Lw9sH5JmcwRBU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713902695; c=relaxed/simple; bh=MJi5gjIzn7AhYmo83oAgzV+mOc7N0YMwUXa129Fztr0=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=hcGEDd5uE7hmjNesmtuo1+EX3yrJ5PEfu8mpiM2EEu7MQ/9kBpoZ5HdvB+wt9spvWN3A4G3yDS0SBGvBXCeOn2ms2B1raRfrbzVFgKxHbjygLnFWjNTcKyhymQdrYlXDGUrhJ/iRvGHfU2H/K3Ww5hsKF7nUrht47ERyfmD/s/0= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713902687; 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: in-reply-to:in-reply-to:references:references; bh=lwVewjRLYhVO/4P824acBa8ADqtk94TdOeIaPVxZWRk=; b=TCk2ib08uhsFfof63XHohnbnbe1aqmpflrCMdJa03ApCfZHjGuERO9f4LLST7Svf4LrTcV /zfAIzHlSy/qoBIrs1SSBLlkzzFUUNYfSvG+z5L01Imh0ip1rhStGyxrn44Vt83qLJV+eO uD3LWFl43YwoxksZgTHPrS1hN37L6rk= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-668-MiQhiQKmMzG1PZo8p19llw-1; Tue, 23 Apr 2024 16:04:22 -0400 X-MC-Unique: MiQhiQKmMzG1PZo8p19llw-1 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-343da0a889dso5431890f8f.0 for ; Tue, 23 Apr 2024 13:04:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713902656; x=1714507456; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=lwVewjRLYhVO/4P824acBa8ADqtk94TdOeIaPVxZWRk=; b=avaNlEgT1nP/WV4QaEbldZWm4leRgl29gpg47ns7bzHjJXWwpA/XtOvLvp4U/gq9zJ yiMpERWclVw4Cy+jQqyHY9y/cv5J7T6K0F9oBd6pWlQqSlXBFja/TVB7FjY4aw/XZvQi gkJPolNXq4JvCNNx3kflrazTRfedv6E7ucLsVQcHIdWHqHHhMzTDQoSQQe15eFdPkpw9 nUyEopZDIbLX82MHbjBs6Gdf2mecrGq9J01m1ysWNjrH0Taq1hcwuwfZwAymV1HbZC2C nxdBlrulutpAO4TOVx9o6F/OAknNzp7B5J+D7t7aoRRC3yHNbfwSC0ZeARL1w04SO7hE qEAA== X-Gm-Message-State: AOJu0YwtryeVAu4xOp5GEqe7ZpS06jG7XYpd4gTuXUY+vdvey46sXwtX PahHEzziSSnb5E5SU4HF4eFGRPP638b6wtzlNkOrbmJXuVVstMd3AGDAGAuLlWHiVnh54OM5yGq 2E1IsDkbMP7VygM2oefN4qLqYrp+M/URiyvHP9QpyUSEvVLKRUd85PgJakw/zXsG7dKw= X-Received: by 2002:a05:600c:450e:b0:41a:908c:b841 with SMTP id t14-20020a05600c450e00b0041a908cb841mr203459wmo.32.1713902655973; Tue, 23 Apr 2024 13:04:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHRJAcxLQ1QvItcELO8VYOzXU+V/k6lO+r+oKygi++FzxqJ9rzIVeFXYEDCPO9OhmJ8Vrj18g== X-Received: by 2002:a05:600c:450e:b0:41a:908c:b841 with SMTP id t14-20020a05600c450e00b0041a908cb841mr203432wmo.32.1713902655233; Tue, 23 Apr 2024 13:04:15 -0700 (PDT) Received: from localhost (185.223.159.143.dyn.plus.net. [143.159.223.185]) by smtp.gmail.com with ESMTPSA id p6-20020a05600c468600b0041563096e15sm25438722wmo.5.2024.04.23.13.04.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 13:04:14 -0700 (PDT) From: Andrew Burgess To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] gdb/remote: fix qRcmd error handling In-Reply-To: <8734rdsb51.fsf@tromey.com> References: <8734rdsb51.fsf@tromey.com> Date: Tue, 23 Apr 2024 21:04:14 +0100 Message-ID: <87v847u9q9.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.2 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: Tom Tromey writes: >>>>>> "Andrew" == Andrew Burgess writes: > > Andrew> Introduced a bug in the error handling of the qRcmd packet. Prior to > Andrew> this commit if a packet had status PACKET_OK then, if the packet > Andrew> contained the text "OK" we considered the packet handled. But, if the > Andrew> packet contained any other content (that was not an error message) > Andrew> then the content was printed to the user. > > Andrew> After the above commit this was no longer the case, any non-error > Andrew> packet that didn't contain "OK" would be treated as an error. > > The patch itself seems reasonable to me, but at the same time, isn't the > behavior you describe also fine? > > The docs describe "OK", other "O" output packets, the "E" response, and > the empty response. It seems to me that any other response could > reasonably be treated as an error. The behaviour I'm restoring is documented, see the 'OUTPUT' entry in the 'Reply:' list: 'qRcmd,COMMAND' COMMAND (hex encoded) is passed to the local interpreter for execution. Invalid commands should be reported using the output string. Before the final result packet, the target may also respond with a number of intermediate 'OOUTPUT' console output packets. _Implementors should note that providing access to a stubs's interpreter may have security implications_. Reply: 'OK' A command response with no output. 'OUTPUT' A command response with the hex encoded output string OUTPUT. 'E NN' Indicate a badly formed request. The error number NN is given as hex digits. '' An empty reply indicates that 'qRcmd' is not recognized. This behaviour has existed since commit 96baa820df8126 the "initial import" commit, and was only broken by accident in commit 3623271997a5 2 weeks ago. So I think we should restore this behaviour, ideally before the next release branches. Thanks, Andrew