From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) by sourceware.org (Postfix) with ESMTPS id B646B3858C52 for ; Tue, 13 Feb 2024 12:56:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B646B3858C52 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B646B3858C52 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=209.85.221.54 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707828999; cv=none; b=NNfdf7fQFji1S6b99+D2AmezzojrSyueb5UG3SxTPXT46whfPNe3sw4l3YqgYGHsHCc6utV8fUhincJjXtmVodFog0IZv1rIXLB6Gw7X/cLocAz5czIy/apm367TA3gAK4sI4D9ZUWCPHNgbmUCqCNGWzh8pzg383I9+u03X1mg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707828999; c=relaxed/simple; bh=9XcSC/1kU6CBtq39ga/ZXpfYqWhg3Kx9f9FqCWHke1E=; h=Message-ID:Date:MIME-Version:Subject:From:To; b=Mz3zeJOnTZcYCR6yhHJTNKbBDRU/68UaMAp9RjrMQPplcFrk/C98A+1UIFmleZsvwLguaqRWMSVEWYaU1IlkPxH4BehEDRgSYv7YcdESnrocFZKbi9UKluDmrooYdIb0zH4zVK37oS5s6MTkNfginvpIGTIQ/qmf0vurtG7SdKg= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-33b66883de9so3011223f8f.0 for ; Tue, 13 Feb 2024 04:56:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707828994; x=1708433794; h=content-transfer-encoding:in-reply-to:references:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=8F4CvpPuZe8FZurKIint7LSpzOLzSqBXqtawTB1lPsU=; b=iWFzAbih10mgLRS36gfRn0B5Je3ZGkUQrwy2iT/GAtTefouTXapdxm17beXhqMLcV6 Qwtgl7pXTogXIE17r3eGs5Gbubh898d44kQrWCD4v5zcTWW30ADrACw9r8d3Y8KWbeUG XzI2GFqcUTz2F1lB1pkN+j584nrBRSRSyml/5yfTjBoN+T1G4eiHdGYzRvKM2JtUM6JJ NErhdMB0MdCy2U3P+ThWGFttel0+4MpTQPv03ku7vbIukmHtevyN8gu7VzLRBTMDUp15 n8SXBohi4i0j3tEgEjRUczUIJ1QRWTWwClmDa0j12N2zEpbeo1sbZmsjOgHTG1eRZYtX ajIw== X-Gm-Message-State: AOJu0Yx03h90SjOT5ENqN4RPRVvGxXhcmMs0hyZ1OFrshk1PrNtWmfhi 8qkUdjxRN3IhqDuH/DeqNegBbiSAJkVJ4qw7kDOLtwRKHQihi+9bwohJm4RzNi4= X-Google-Smtp-Source: AGHT+IGU3CV0ak+KUf7iLPiUdq/Bsy4csoB7PnVcaxwPIFur2PkXSGFrJvMz0YvDGy3yQXTSUo95Eg== X-Received: by 2002:adf:fd06:0:b0:33b:2d1d:6f6d with SMTP id e6-20020adffd06000000b0033b2d1d6f6dmr6647950wrr.15.1707828993518; Tue, 13 Feb 2024 04:56:33 -0800 (PST) Received: from ?IPV6:2001:8a0:f923:4f00:f2aa:afcb:8afe:c91e? ([2001:8a0:f923:4f00:f2aa:afcb:8afe:c91e]) by smtp.gmail.com with ESMTPSA id t24-20020adfa2d8000000b0033b86b38611sm4219935wra.10.2024.02.13.04.56.32 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 13 Feb 2024 04:56:33 -0800 (PST) Message-ID: Date: Tue, 13 Feb 2024 12:56:31 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/3] Improve vRun error reporting Content-Language: en-US From: Pedro Alves To: gdb-patches@sourceware.org References: <20240212200153.882582-1-pedro@palves.net> <20240212200153.882582-3-pedro@palves.net> In-Reply-To: <20240212200153.882582-3-pedro@palves.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-10.3 required=5.0 tests=BAYES_00,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,GIT_PATCH_0,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,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: Hi! This conflicts with Alexandra's just-merged packet_check_result changes. I see she has some follow up patches that would help me here. I will take a look at those. For the meantime, disregard this patch. Pedro Alves On 2024-02-12 20:01, Pedro Alves wrote: > After the previous commit, if starting the inferior process with "run" > (vRun packet) fails, GDBserver reports an error using the "E." verbose > error packet. On the GDB side, however, GDB doesn't yet do anything > with verbose error strings when handling vRun errors. This commit > fixes that. > > This makes remote debugging output the same as native output, when > possible, another small step in the "local/remote parity" project. > > E.g., before, against GNU/Linux GDBserver: > > (gdb) run > Starting program: .../gdb.base/run-fail-twice/run-fail-twice.nox > Running ".../gdb.base/run-fail-twice/run-fail-twice.nox" on the remote target failed > > After, against GNU/Linux GDBserver (same as native): > > (gdb) run > Starting program: .../gdb.base/run-fail-twice/run-fail-twice.nox > During startup program exited with code 126. > > Change-Id: Ib386f267522603f554b52a885b15229c9639e870 > --- > gdb/remote.c | 23 +++++++++++++++++++++-- > 1 file changed, 21 insertions(+), 2 deletions(-) > > diff --git a/gdb/remote.c b/gdb/remote.c > index b58dbd4cb66..dca5add260a 100644 > --- a/gdb/remote.c > +++ b/gdb/remote.c > @@ -2400,6 +2400,19 @@ add_packet_config_cmd (const unsigned int which_packet, const char *name, > } > } > > +/* Strings that starts with "E.", are verbose error messages, like > + "E.ERROR_MESSAGE". If BUF is such an error message, return a > + pointer to message after the period. Otherwise return NULL. */ > + > +static const char * > +verbose_error_message (const char *buf) > +{ > + if (buf[0] == 'E' && buf[1] == '.') > + return buf + 2; > + else > + return nullptr; > +} > + > static enum packet_result > packet_check_result (const char *buf) > { > @@ -2415,7 +2428,7 @@ packet_check_result (const char *buf) > > /* Always treat "E." as an error. This will be used for > more verbose error messages, such as E.memtypes. */ > - if (buf[0] == 'E' && buf[1] == '.') > + if (verbose_error_message (buf) != nullptr) > return PACKET_ERROR; > > /* The packet may or may not be OK. Just assume it is. */ > @@ -10502,7 +10515,13 @@ remote_target::extended_remote_run (const std::string &args) > case PACKET_UNKNOWN: > return -1; > case PACKET_ERROR: > - if (remote_exec_file[0] == '\0') > + /* If we have a verbose error message, print just that. This > + makes remote debugging output the same as native output, when > + possible. */ > + if (const char *msg = verbose_error_message (rs->buf.data ()); > + msg != nullptr) > + error (("%s"), msg); > + else if (remote_exec_file[0] == '\0') > error (_("Running the default executable on the remote target failed; " > "try \"set remote exec-file\"?")); > else