From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) by sourceware.org (Postfix) with ESMTPS id E48483856269 for ; Fri, 27 May 2022 17:11:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E48483856269 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f53.google.com with SMTP id i9-20020a1c3b09000000b00397345f2c6fso508002wma.4 for ; Fri, 27 May 2022 10:11:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=fi+zOoJ+GJjQ004Hv1y2dxf8/BYOlbnjYOjP6v1KOyo=; b=HtWRHq1fNdkOOLsKIPfrN8fBOI1SG2JMlbGrE/hX+BO0CxIuinGxL2Hsr6Xz4ButyK i7jARlHZgFP21/NqZTDSRvOTr/wsEEYcEDiTaYNi6QN4BXFOgvNBtRk3BICGgoysXKzo me/6+XRG2xcN7dBfyckZzFJf05DzL1We3m6lYdb0Kl2ClRSozrvUJXi6YVBaLMYVxfjd JUMBH91l/yBPp9ZUD8r5ZL5VYgOW5jCG3R5IduYmFX7ExfVjkpMOJWgJy2qZSKLNK8Aa Q7rPAmdYMRJBd5cU4LeBFJISCYqm5/FUYsp3mE98br3wbKvgKvlVCtUaAEg9SMHgy+ue ZQUw== X-Gm-Message-State: AOAM531wQg53DOnJ0m/v0JRvEdfNEkdIIFVdq+3Y5saJgIQrBIQawP4V 2hKkKi7TOVlhrAdOld5IKYINtWFmWfc= X-Google-Smtp-Source: ABdhPJy4S9+chv/7tKdnJUAk7TnwjBcS8rFnw1KB+bYNtryF6rrSIO2OIWGXpCLafXFRGMn1qbEpXg== X-Received: by 2002:a7b:c4ca:0:b0:397:3bac:9b2a with SMTP id g10-20020a7bc4ca000000b003973bac9b2amr7814118wmk.154.1653671466799; Fri, 27 May 2022 10:11:06 -0700 (PDT) Received: from ?IPV6:2001:8a0:f924:2600:209d:85e2:409e:8726? ([2001:8a0:f924:2600:209d:85e2:409e:8726]) by smtp.gmail.com with ESMTPSA id i18-20020a5d5592000000b0020c5253d8dasm2187889wrv.38.2022.05.27.10.11.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 27 May 2022 10:11:05 -0700 (PDT) Message-ID: <2bc9b5c9-879a-2848-16f4-6cfd796563a8@palves.net> Date: Fri, 27 May 2022 18:11:04 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH v4] gdb/manual: Introduce location specs Content-Language: en-US To: Eli Zaretskii Cc: gdb-patches@sourceware.org References: <20220526194250.2310460-1-pedro@palves.net> <8335gvnjrw.fsf@gnu.org> <956e1fbd-5f03-c021-c390-82e1cf3493b5@palves.net> <83wne7m0ri.fsf@gnu.org> From: Pedro Alves In-Reply-To: <83wne7m0ri.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, NICE_REPLY_A, 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 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 May 2022 17:11:09 -0000 On 2022-05-27 16:52, Eli Zaretskii wrote: >> Date: Fri, 27 May 2022 16:04:32 +0100 >> Cc: gdb-patches@sourceware.org >> From: Pedro Alves >> >>> > +A concrete code location in your program is uniquely identifiable by a >>> > +set of logical attributes. Typically, a line number, the source file >>> > +the line belongs to, the fully-qualified and prototyped function it is >>> > +defined in, and an instruction address. Because each inferior has its >>> > +own address space, also an inferior number. >>> >>> The "typically" part and the overall style seem to say that this is >>> not the exhaustive list of all the attributes of a code location, just >>> a general idea. Can you please present a full exhaustive list of the >>> attributes of a code location? >> >> I meant to remove the "typically", and forgot it, sorry. It is not >> supposed to be there. > > OK, so I take it the full list is: > > . absolute file name of the source > . line number in the source file > . fully-qualified and prototyped function > . address > . inferior number Yes. Well, except "absolute" in the file name. The file names in the debug info aren't always absolute, they can be something like ../a/b/c/foo.c, and we may not be able to find the source file in the filesystem, so the path the debug info tells us is all we get. > >>> And another question: does the process of resolving a location spec to >>> obtain the corresponding code locations involve only filling in of the >>> attributes that were omitted from the spec, or does it also produce >>> attributes that can _never_ be part of the location spec? IOW, can >>> the user type a location spec which will yield a code location that is >>> 100% identical to the input spec? >> >> Currently there's no way to explicitly specify the inferior with >> any format of location specifications. So if you do "b func", and you >> have multiple inferiors, GDB will find code locations for "func" in all >> the inferiors. All the other attributes you can explicitly specify. >> Not sure whether that answers your question. > > I think it does, but: > >> I am not sure what you >> mean by "100% identical". A spec can never the identical to the actual >> thing, the same way a cake recipe can never be identical to a cake, for >> they are things of different nature. It can only be that the actual >> thing complies with or follows the spec. > > I thought you just explained above that, when there's only one > inferior, the user can give a location spec which will resolve to a > code location that has exactly the same attributes as the spec? IOW, > in this case the "resolution" of the spec produces a "thing" that to > the user looks exactly the same as the input spec? When you specify a function name, you can't specify an address at the same time, for example. There's no format that allows that. So if you specify a function, you end up with code location that has an address, but you didn't specify the address. Conversely, when you specify an address, gdb finds the source/line for the address if available, as well as the function. So you can't pass the whole set of attributes at once, some combinations can't be specified, or are incompatible/ignored. And then GDB knows more about the code locations than that set of attributes, of course. GDB knows the architecture of the instruction the location points at, for example.