From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25263 invoked by alias); 25 Nov 2014 23:37:05 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 25246 invoked by uid 89); 25 Nov 2014 23:37:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mail-ob0-f182.google.com Received: from mail-ob0-f182.google.com (HELO mail-ob0-f182.google.com) (209.85.214.182) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 25 Nov 2014 23:37:03 +0000 Received: by mail-ob0-f182.google.com with SMTP id m8so1339032obr.27 for ; Tue, 25 Nov 2014 15:37:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=2YbtQW80+UbeZrHf6/rzxErrx+Ys1heAdBuJ1zYPHtg=; b=fvy7K7KQz7Bt8XCqG6fGecuYkueZdbcGOk6SDipxqnG6/MruntliXKSlAfY69nnkSo UzkUqixUqdW2O/iftV3dvYSr1Xnwe31uBq9Kdh0ABkQBtOQxZ/4hLaP3fKrbzPRiOS1E smR8rJynmM0CpxCEthHSEUtMF3eVpxcOpWdE3wRhs4FB/p5gDqIbxqS6fDGvd0IHXZRN 5fuFgObDqZ1G1IuZrv0bR9Y8PCpBSMuJkpMWQSj1+eRk7OkokTy+G7Akx2nbf3HK2rko bAVeNwtQcGIRa4k8PdDlaiOVw5dosrqbApyrb8aJ3/cn9V8AMjgJ77wof+Woh+hu7i46 6SGQ== X-Gm-Message-State: ALoCoQkMl4qpyTh/vI3OFjLnUn2vwS9fJO2kFjEcX36nxM9H/2J0+LsX7DCSxHXrHRou22zLoqJN MIME-Version: 1.0 X-Received: by 10.182.97.35 with SMTP id dx3mr201409obb.30.1416958621211; Tue, 25 Nov 2014 15:37:01 -0800 (PST) Received: by 10.202.225.68 with HTTP; Tue, 25 Nov 2014 15:37:01 -0800 (PST) In-Reply-To: References: Date: Tue, 25 Nov 2014 23:37:00 -0000 Message-ID: Subject: Re: [RFC] While processing a struct die, store the method's address in its fn_field From: Siva Chandra To: Doug Evans Cc: gdb-patches Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2014-11/txt/msg00635.txt.bz2 On Tue, Nov 25, 2014 at 2:09 PM, Doug Evans wrote: > For functions/methods gdb already uses lowpc as the start address. May be I am reading wrong somewhere, but if I am correct, GDB currently gets to a low pc (the address of the method) of a method via its symbol. So, I agree that GDB uses low pc anyway. > [IOW it doesn't use the linkage name, though even recently > I'd forgotten this and thought otherwise. > Also, GDB doesn't take a demangled name, mangle it, > and then try to look that up in the ELF symbol table.] May be I messed up some terminology somewhere, symbol handling side of GDB is new to me. But, looking at value_fn_field, it appears to me that GDB gets a method's address via its linkage name (first looking up its symbol/minsym). Also, value_fn_field uses lookup_symbol which uses lookup_symbol_in_language which demangles the linkage name. Based on this, I concluded that GDB cannot get the address of a method if the linkage name is missing. This is my understanding now, which could be wrong ofcourse! >> [Clang >> actually does not put out the low pc value for the subprogram die >> under a structure die, but it puts out a separate (not under a >> structure die) subprogram die for the operator() method with the low >> pc value.] > > DWARF can be hard to read at times. > Note that GCC can do this too. E.g., > It will output a declaration in the proper context > (e.g., inside a class definition for a method) without DW_AT_low_pc > and then it will output another DIE at the top level with DW_AT_low_pc > and with a DW_AT_specification referring back to previous DIE in its context. Yes, Clang takes this exact route and things work fine with a Clang generated binary. GCC does not generate the top level DIE at all, but stuffs in DW_AT_low_pc into the DIE under the class definition and does not specify the linkage name. So, there is no DIE specifying the linkage name of operator(). IMO however, what GCC is emitting is logical sufficient. In which case, GDB needs to store the low pc value somewhere, and my patch puts it in the type struct. Thanks, Siva Chandra