From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 70878 invoked by alias); 8 Dec 2017 11:12:13 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 70865 invoked by uid 89); 8 Dec 2017 11:12:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 08 Dec 2017 11:12:12 +0000 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 48D4F13A88; Fri, 8 Dec 2017 11:12:11 +0000 (UTC) Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 95323183B4; Fri, 8 Dec 2017 11:12:10 +0000 (UTC) Subject: Re: Handling language trampoline To: Dmitry Antipov , gdb@sourceware.org References: <690fc1d3-9ba9-51ef-054d-9478993015a6@nvidia.com> <7a5a19c6-c1bb-b67a-d302-a78ed8f001fa@redhat.com> <8ea7083d-d914-c463-c7f3-22bd57ac5a6d@nvidia.com> From: Pedro Alves Message-ID: <2a2ad2bb-060b-cdd2-ad18-a6773998edbc@redhat.com> Date: Fri, 08 Dec 2017 11:12:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <8ea7083d-d914-c463-c7f3-22bd57ac5a6d@nvidia.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-12/txt/msg00009.txt.bz2 On 12/08/2017 06:39 AM, Dmitry Antipov wrote: > On 12/07/2017 05:58 PM, Pedro Alves wrote: > >> I don't offhand see how can GDB know which is the right >> language for the current PC the program just stopped at, and >> if the program stopped inside a trampoline. That's part of >> each language's skip_trampoline's job, so seems reasonable >> that GDB has to try them all. > > I'm not an expert in this area too, but, in theory, what's the > problem if we have (presumably valid) DWARF info? Looking through > DWARF4 specs, each CU should have DW_AT_low_pc and DW_AT_high_pc; > so, if CU->DW_AT_low_pc <= current PC <= CU->DW_AT_high_pc, then > CU->DW_AT_language is the language in question, isn't it? Some trampolines are generated by the compiler/linker, and I assume there's no debug info for them? E.g., for C++, see gnuv3_skip_trampoline, and virtual thunks. I don't know whether that's the case for objc, but from: /* Determine if we are currently in the Objective-C dispatch function. If so, get the address of the method function that the dispatcher would call and use that as the function to step into instead. Also skip over the trampoline for the function (if any). This is better for the user since they are only interested in stepping into the method function anyway. */ static CORE_ADDR objc_skip_trampoline (struct frame_info *frame, CORE_ADDR stop_pc) { I'd assume that the "dispatch function" is a part of the objc runtime and that this is meant to work if there's no debug info for the objc runtime installed. Thanks, Pedro Alves