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 7674A3858410 for ; Fri, 17 Mar 2023 13:33:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7674A3858410 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679060038; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AubxOmiUczyfHDsGcdBUtUFxEds+qqYfpLxUiDYofW0=; b=ERxqyBMvVpn87rQhohvz7FekYcQdyIPgHVUa37zntVwvKvg1BooHVuE2lET7va7JXmvYDI QepI7j+iC98vv/niv5OEVfeFbQlh/RuXW/jkQ8Tb/Rf6wnjEksSZB3QoPHwA2mbujZo5Dx 9O6L4FPA4BMH7V1ptjN6g1CiO6dM+lg= Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-460-PITbvFDjMqW6ZEN9mFIKxA-1; Fri, 17 Mar 2023 09:33:57 -0400 X-MC-Unique: PITbvFDjMqW6ZEN9mFIKxA-1 Received: by mail-qt1-f199.google.com with SMTP id l2-20020ac87242000000b003bfecc6d046so2516591qtp.17 for ; Fri, 17 Mar 2023 06:33:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679060035; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=AubxOmiUczyfHDsGcdBUtUFxEds+qqYfpLxUiDYofW0=; b=Oe4XSrNZDpyY4nsGH1B5Ao3NWaYrAvhHXjcIyyxdWF4X09TdkfLSTuQYtWN/5XCA0l 6nKnSIzmZYRu8lohilcHvMEN0FW5RO8id3Wc0dVggRUvZ7A1F4aWQDX1ojH+wOSq/E3h dBja0SwM3p3DDAhytVH3v4om6a3q/dR3pJJ5AvfN6BipQy00YDOrDz1cGIkgnrzZRGp4 +zIxbS1UCuQWer5ojpJxRYls4bpSid4HkMo8rrcvBGcinTpHmm4JsY0NxqC5cAG2LaHI WCKtxRc8mhu3euO0xZNN+SmOeAFWrcNbhIQHzM4Qscdv5EUxY6ayLeFEhxjkAotFaX+F L1Ow== X-Gm-Message-State: AO0yUKXcDAd0bHM2JIQmatu9EwpyLIfiNVk1N8KldblfuuVAvQjX0kBp M5WWUmq88vq6NmohHjfTAjY61C6ZYG+uLZrsT2ylO3+EFpqtyOQWflZeeKKoet6kwTh16xPGadL TEi091q2+U5EabYxZsFBoh4mlBhoSiw== X-Received: by 2002:a05:622a:387:b0:3bf:a5fb:6d6e with SMTP id j7-20020a05622a038700b003bfa5fb6d6emr10531960qtx.29.1679060035733; Fri, 17 Mar 2023 06:33:55 -0700 (PDT) X-Google-Smtp-Source: AK7set8/EQ1YFBP+YMNEz7wczKG04MT3gPb9StuAIvk6aeB66/smYKNW0iYbusnVV2Gt9m7sSqvUSQ== X-Received: by 2002:a05:622a:387:b0:3bf:a5fb:6d6e with SMTP id j7-20020a05622a038700b003bfa5fb6d6emr10531938qtx.29.1679060035457; Fri, 17 Mar 2023 06:33:55 -0700 (PDT) Received: from [192.168.0.45] (ip-94-112-225-44.bb.vodafone.cz. [94.112.225.44]) by smtp.gmail.com with ESMTPSA id h12-20020ac8548c000000b003d58d0297e5sm1529948qtq.3.2023.03.17.06.33.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 17 Mar 2023 06:33:55 -0700 (PDT) Message-ID: <3619ffc8-1050-c586-3da4-e98dc0649754@redhat.com> Date: Fri, 17 Mar 2023 14:33:51 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH 1/1] gdb: Avoid warning for the jump command inside an inline function. To: "Willgerodt, Felix" , "gdb-patches@sourceware.org" References: <20230124151932.2471769-1-felix.willgerodt@intel.com> <103d7434-d7ad-b03b-5724-d6f9d6846749@redhat.com> From: Bruno Larsen In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,RCVD_IN_BARRACUDACENTRAL,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,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: On 17/03/2023 13:56, Willgerodt, Felix wrote: >> -----Original Message----- >> From: Bruno Larsen >> Sent: Freitag, 17. März 2023 11:14 >> To: Willgerodt, Felix ; gdb- >> patches@sourceware.org >> Cc: Cristian Sandu >> Subject: Re: [PATCH 1/1] gdb: Avoid warning for the jump command inside >> an inline function. >> >> On 24/01/2023 16:19, Felix Willgerodt via Gdb-patches wrote: >>> When stopped inside an inline function, trying to jump to a different line >>> of the same function currently results in a warning about jumping to >> another >>> function. Fix this by taking inline functions into account. >>> >>> Before: >>> Breakpoint 1, function_inline (x=510) at jump-inline.cpp:22 >>> 22 a = a + x; /* inline-funct */ >>> (gdb) j 21 >>> Line 21 is not in `function_inline(int)'. Jump anyway? (y or n) >>> >>> After: >>> Breakpoint 2, function_inline (x=510) at jump-inline.cpp:22 >>> 22 a = a + x; /* inline-funct */ >>> (gdb) j 21 >>> Continuing at 0x400679. >>> >>> Breakpoint 1, function_inline (x=510) at jump-inline.cpp:21 >>> 21 a += 1020 + a; /* increment-funct */ >>> >>> This was regression-tested on X86-64 Linux. >>> >>> Co-Authored-by: Cristian Sandu >>> --- >>> gdb/infcmd.c | 3 +- >>> gdb/testsuite/gdb.base/jump-inline.c | 30 +++++++++++++++++ >>> gdb/testsuite/gdb.base/jump-inline.exp | 45 >> ++++++++++++++++++++++++++ >>> 3 files changed, 77 insertions(+), 1 deletion(-) >>> create mode 100644 gdb/testsuite/gdb.base/jump-inline.c >>> create mode 100644 gdb/testsuite/gdb.base/jump-inline.exp >>> >>> diff --git a/gdb/infcmd.c b/gdb/infcmd.c >>> index fd88b8ca328..40414bc9260 100644 >>> --- a/gdb/infcmd.c >>> +++ b/gdb/infcmd.c >>> @@ -1091,7 +1091,8 @@ jump_command (const char *arg, int from_tty) >>> >>> /* See if we are trying to jump to another function. */ >>> fn = get_frame_function (get_current_frame ()); >>> - sfn = find_pc_function (sal.pc); >>> + sfn = find_pc_sect_containing_function (sal.pc, >>> + find_pc_mapped_section (sal.pc)); >> Hi Felix, >> >> Thanks for doing this, it is a good improvement, but I don't know if >> this is the best way to go about it. Is there a reason why >> find_pc_function should not return inlined functions? >> >> I feel like most of the time we want to know the function, knowing if >> we're in an inlined one would be desirable, but I might be wrong. Does >> anyone know? >> > Hi Bruno, > > I don't know the details, but the comments in symtab.h are rather explicit > about it, so I assume there is a reason: > > > /* lookup the function symbol corresponding to the address. The > return value will not be an inlined function; the containing > function will be returned instead. */ > > extern struct symbol *find_pc_function (CORE_ADDR); > > /* lookup the function symbol corresponding to the address and > section. The return value will be the closest enclosing function, > which might be an inline function. */ > > extern struct symbol *find_pc_sect_containing_function > (CORE_ADDR pc, struct obj_section *section); Hi Felix, I thought it was mostly a descriptive comment, rather than prescriptive. I tested changing find_pc_function locally and there were only 2 regressions, which might just be broken assumptions, but our testsuite is probably not very comprehensive on inlined functions, so I don't know how representative this test actually is. -- Cheers, Bruno > > Thanks, > Felix > Intel Deutschland GmbH > Registered Address: Am Campeon 10, 85579 Neubiberg, Germany > Tel: +49 89 99 8853-0, www.intel.de > Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva > Chairperson of the Supervisory Board: Nicole Lau > Registered Office: Munich > Commercial Register: Amtsgericht Muenchen HRB 186928