From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 0P0dHgYhkWI7uwgAWB0awg (envelope-from ) for ; Fri, 27 May 2022 15:05:42 -0400 Received: by simark.ca (Postfix, from userid 112) id 77F971E221; Fri, 27 May 2022 15:05:42 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, NICE_REPLY_A autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id BA70D1E01D for ; Fri, 27 May 2022 15:05:41 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2A0FC38387C2 for ; Fri, 27 May 2022 19:05:41 +0000 (GMT) Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) by sourceware.org (Postfix) with ESMTPS id 02B50383B7B4 for ; Fri, 27 May 2022 19:05:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 02B50383B7B4 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-wr1-f47.google.com with SMTP id t6so7010132wra.4 for ; Fri, 27 May 2022 12:05:28 -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=K2f3plHiyPSYKAbRxUj9/FrqOl4TOQ9mK76Xl5YBEm8=; b=wqxJLEqwo2r+nypsXFyh1KEnRSmfsvsQRiJs52BEJsFhAJWrqCld48PC49YCQpkrDs iSW9SSLdxGH8HeuAf7l4JQkD02Zj7oeCG2qQ35Di09wNaHeLNICApBdJ3KoPdgUiOMRt oHG3Sk8VM6VrdOopqLhxGT3D0WmAqvjWo61v21MnEqhIuQV0g2lKUprdv4inPJnbeNOK tDyZK/cMz5AmpP98FBLRfCgAV0jlr9KNxmxOq7CTd9docKEp9Ab5LuAkK+3arpxjjLVg ZsTLfgugK6KLyY7Gkpg+jyL/qX6iSOv4aCHLH9gd6WtWnHG3ziZS0JqBgykq1vv+J5xW 49KA== X-Gm-Message-State: AOAM533uw45HQYfkKTT6dD41cJoTibPDnII6pKESypooWCIOf4+hd9Dk vCss1D1sDg/etPgpR04X1Jg= X-Google-Smtp-Source: ABdhPJzACI4eIXsW2y4ATEdTRtm0H+qhDGK3/LqcsqhvPh15phsI+KpQVhuBsqp6WPAa1XOoSEJXuA== X-Received: by 2002:a5d:6d0d:0:b0:20f:e7b6:60e5 with SMTP id e13-20020a5d6d0d000000b0020fe7b660e5mr19419080wrq.23.1653678328020; Fri, 27 May 2022 12:05:28 -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-20020a5d5592000000b0020c5253d8dasm2375731wrv.38.2022.05.27.12.05.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 27 May 2022 12:05:26 -0700 (PDT) Message-ID: <977cfe4d-d9d8-98e8-fffb-40c3f9920897@palves.net> Date: Fri, 27 May 2022 20:05:25 +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 References: <20220526194250.2310460-1-pedro@palves.net> <8335gvnjrw.fsf@gnu.org> <956e1fbd-5f03-c021-c390-82e1cf3493b5@palves.net> <83wne7m0ri.fsf@gnu.org> <2bc9b5c9-879a-2848-16f4-6cfd796563a8@palves.net> <83sfounaqw.fsf@gnu.org> <02a46873-35dc-0d9c-1890-292b807d9484@palves.net> <83pmjyn8as.fsf@gnu.org> <113bd07c-3bfe-0780-50a9-4c41c84942e9@palves.net> <83o7zin6ua.fsf@gnu.org> From: Pedro Alves In-Reply-To: <83o7zin6ua.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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: , Cc: gdb-patches@sourceware.org Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On 2022-05-27 19:55, Eli Zaretskii wrote: >> Date: Fri, 27 May 2022 19:42:50 +0100 >> Cc: gdb-patches@sourceware.org >> From: Pedro Alves >> >>> Yes, but note that the last revision of your patch says "resolves >>> into", not "matches". Which I think is a change for the better; I'm >>> trying to have a more accurate idea of what that "resolution" entails. >> >> Resolution is the act of find all the actual code location that match the user >> input. The found locations are the resolved code locations. >> >> Here for example: >> >> +@item list @var{locspec} >> +Print lines centered around the line or lines that @var{locspec} >> +resolves to. >> >> The meaning is that the user passes some input spec to GDB, which >> may even not specify any line at all, like "line func", and GDB >> finds all the matching locations. For each resolved location, you have >> a resolved line, resolved source file, resolved addr, resolved function, etc. > > I understand (I think). But all this does is fill in the attributes > that were missing from the input location spec. This is done either > by using the (implied) defaults, like the name of the current file, or > bhy using the debug info. And if it turns out that some attribute can > be filled in more than one way, we have a breakpoint with multiple > code locations. Right? > You start with e.g., just one attribute, like "-function func". This makes GDB iterate over all the functions is knows about, finding the ones that are called "func". This matches "func(int)", "A::func()", "func(long)", etc. GDB collects the PC and source file and line number of those functions too along the wa. If you did "break -function func", then you end up with a breakpoint with multiple code locations, one for each function matched. Or you start with "a/file.c:100". This makes GDB iterate over all source files it knows about, and then for each that has a file name that ends with "a/file.c", like e.g., "src/program/a/file.c" and "somelib/a/file.c" it searches for line 100, collecting the PC and function name of the location. If you did "break a/file.c:100", you end up with a breakpoint with multiple locations, one per resolved location. If you did "list a/file.c:100", GDB lists the source for around each of the locations. Etc. Or you start with "*0x1000". Conceptually it's the same. GDB finds the code locations that match that, resolves that to a location with PC/function/source/line, and then the command does what it wants with it.